; Set parameters for Mail plugin
mail.error_dialog_off()
mail.use_long_vars()
mail.returns_values()
; Set directory for icon library (could be done in a startup script)
ILib="C:\Program Files\PowerPro\Icons\IconLibrary.icl"
; If not already set, set server parameters
If (MailServer == "") do
MailServer = "[server name]"
MailUser = "[user name]"
MailPass = "[password]"
Endif
; Start connecting to account (done in the background using Alan's
; threaded option in Mail plugin). Set an event as a timer to check
; for connection every 2 seconds for 1 minute before timing out.
; Show the "checking" icon while connecting is in process.
mail.connect_to_accnt_threaded(MailServer, MailUser, MailPass)
ev_connect_mail = event.create(2,30,".MailCheck@OnEvent")
Format Item item 13 list "DeskIcons" iconfile &(ILib) iconnum 200
quit
@OnEvent
; Every 2 seconds, event comes here to see if connection has been
; made--if not, it waits another time cycle
If (mail.check_connected ge 0) do
.MailCheck@DoMail
Endif
Quit
@DoMail
; Once the connection is made, come here to check for messages, etc.
; Shut down the timer event
If (event.exists(ev_connect_mail))
event.destroy(ev_connect_mail)
; Set the timeout for getting messages
mail.set_timeout(4000)
; See if there are new messages and disconnect
ml_no_msgs = mail.get_no_msgs
mail.disconnect()
If (ml_no_msgs gt 0) do
; If there are any messages, change to the appropriate icon
Format Item item 13 list "DeskIcons" iconfile &(ILib) iconnum 202
If (MsgCount eq "" or (ml_no_msgs gt MsgCount)) do
;If there are additional messages since last time (>MsgCount)
;or there were no messages before, then play a sound
do(SoundDir++"message.wav","")
Endif
Else
*Format Item item 13 list "Desk icons" iconfile &(ILib) iconnum 201
Endif
; Assign MsgCount variable to keep track of current number of messages
Assign MsgCount ml_no_msgs
mail.unload()
Quit
|