Automate Outlook Express to collect mail and news

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Automate Outlook Express to collect mail and news

Post by Marcus Tettmar » Sun Nov 15, 1998 12:00 am

Contributed By: Marcus Tettmar [email protected]
Submitted On: 15/11/98

//Either set Outlook Express to use DUN and hangup on exit, or
//combine this script with the Dial Up Networking scripts in this archive

//Start Outlook Express
Run Program>"C:\Program Files\Outlook Express\msimn.exe"

//Wait for it to open
WaitWindowOpen>Outlook Express*

//Give things time to respond and settle down.
Wait>5

//If Outlook is not already set to connect on startup, initiate
//a mail download with the next three lines by Pressing CTRL-M
Press CTRL
Send Character/Text>M
Release CTRL

//Optional Section to close Outlook Express When Done
//Designed for people without a permanent connection, or for
//scheduling an unnattended mail collection at night for example.

//Outlook displays a progress window, which is great for
//scripting, as usually we could watch for that window to appear
//and then disappear so we know when download is complete.
//Unfortunately the name of the Outlook progress window is identical
//to the main Outlook window (when first started), so we need a different
//method, unless you move to and select a folder first.
//
//One way is to use FindWindowWithText in a loop to detect the word
//"Disconnecting".  Like this
//
//Label>WaitDisconnect
//FindWindowWithText>Disconnecting,0,title,0
//Position>Outlook Express,title,1,pos
//If>pos=0,WaitDisconnect
//
//However, this is ok for mail only connections, but if you
//are downloading News headers too, you will find that a second loop
//for a word that appears while downloading news will not exit, because
//the Progress window is only hidden, not closed at the end and the
//text still exists!  Seems like we can't win ... but ...
//
//Instead we get the Coordinates of the active window and watch
//for them to change (as long as no one moves the window manually, the
//coordinates will change when the progress window disappears).
//Any of the above mentioned methods will work in different circumstances
//But this one should work however you have Outlook Express set up.

//Wait for progress window to appear
GetActiveWindow>title,X,Y
Label>WaitForProgress
GetActiveWindow>title,X1,Y1
If>X1=X,WaitForProgress
If>Y1=Y,WaitForProgress

//Wait for progress window to disappear
GetActiveWindow>title,X,Y
Label>Progress
GetActiveWindow>title,X1,Y1
If>X1=X,Progress
If>Y1=Y,Progress

//Mails and news downloaded !

//Close Outlook Express
//Probably don't really need the next wait statement ...
Wait>5
SetFocus>Outlook Express*
Press Alt
Press F4
Release Alt

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts