proc main integer iTask, iWindow, iStatus = 0 string sTaskName if firsttask iTask ;Search list of tasks for outlook.exe taskname iTask sTaskName if strnicmp sTaskName "outlook.exe" 11 ;Search for Outlook process taskwin iTask iWindow winactivate iWindow ;Bring Outlook to foreground launch_message() ;Run procedure to open new message iStatus = 1 ;Set flag indicating Outlook was found endif while nexttask iTask taskname iTask sTaskName if strnicmp sTaskName "outlook.exe" 11 taskwin iTask iWindow winactivate iWindow launch_message() iStatus = 1 endif endwhile endif if iStatus == 0 ;Outlook not active run "c:\program files\microsoft office\office\outlook.exe" pause 5 launch_message() endif endproc proc launch_message pause 3 sendkey CTRLSHIFT 'M' ;Open new message pause 1 sendkey ALT 'J' ;Move to subject line endproc