Ok, I'm getting close but only seem to be getting the first line after the "*C". Here is what everything reads like:
Alarm message that the script fires on:
*C TST ALM - CRITICAL ALARM TEST IN PROGRESS
FOR AUDIBLE AND VISUAL ALARM REPORTING
What is placed in the email sent by the script:
"A Critical alarm has been detected. This is an automated email for the Pittsburgh 5ESS. TST ALM – CRITICAL ALARM TEST IN PROGRESS"
On my usermsgs, I see the following boxes in this order:
"TST ALM - CRITICAL ALARM TEST IN PROGRESS"
"FOR AUDIBLE AND VISUAL ALARM REPORTING"
"Here I get a small box in the message - I think it may be a carriage return"
"Here I get the beginning of a new message" (Which I don't need)
The script:
string sLine1, sLine2, sLine3, sLine4
proc Main
while 1
waitfor "*C" forever matchcase
rget sLine1
rget sLine2
rget sLine3
rget sLine4
call Outlook
endwhile
endproc
proc Outlook
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
pause 2
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
pause 2
launch_message()
iStatus = 1
endif
endwhile
endif
if iStatus == 0 ;Outlook not active
run "c:\program files\microsoft office\office11\outlook.exe" maximized
pause 5
launch_message()
endif
endproc
proc launch_message
pause 3
sendkey CTRL 'N' ;Open new message
pause 1
sendkeystr "Gornek, Kenneth;W, William E."
pause 1
sendkey ALT 'J' ;Move to subject line
pause 1
sendkeystr "Critical PITB 5ESS Alarm - Automated"
sendkey 0x09
sendkeystr "A Critical alarm has been detected. This is an automated email for the Pittsburgh 5ESS."
sendkeystr sLine1
pause 1
sendkeystr sLine2
pause 1
sendkeystr sLine3
pause 1
sendkeystr sLine4
sendkey ALT 'S'
endproc