wingdingking
Programmer
We have several scripts that run at different times using the scheduler. Sometimes one script doesn't finish before a second one begins. This is causing problems with data getting corrupted.
Is there a way to allow only one PW5.EXE to execute at a time? Or put another way, to not run a script if Procomm is already running.
I found a sample script at aspectscripting.com that contains some logic that determines if a Outlook is open and running an thought I could modify it (see below)
I think I can adapt this script to look for PW5.EXE running or not, but don't know enough about scripting in Procomm to write the code to stop the second script.
I thought I would test for a running Procomm and then set a variable. Then if the variable is "1" stop the current script. I don't know how to end a script using aspect other than putting it within if/end loop. Can you jump to the ENDPROC command once the variable is set?
Your help in formatting a script would be greatly appreciated.
--------
Script that searches the Windows task list to find Outlook, brings it to the foreground, opens a new message, and places the focus in the Subject line:
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
Is there a way to allow only one PW5.EXE to execute at a time? Or put another way, to not run a script if Procomm is already running.
I found a sample script at aspectscripting.com that contains some logic that determines if a Outlook is open and running an thought I could modify it (see below)
I think I can adapt this script to look for PW5.EXE running or not, but don't know enough about scripting in Procomm to write the code to stop the second script.
I thought I would test for a running Procomm and then set a variable. Then if the variable is "1" stop the current script. I don't know how to end a script using aspect other than putting it within if/end loop. Can you jump to the ENDPROC command once the variable is set?
Your help in formatting a script would be greatly appreciated.
--------
Script that searches the Windows task list to find Outlook, brings it to the foreground, opens a new message, and places the focus in the Subject line:
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