I've got a compiled script which a few people are running at different times. What I'm currently looking at are times where it has been possible for a single user to end up with multiple instances of the macro executable running concurrently (either running it again whilst the last instance is still running or because it became stuck).
What I want to do is at the start of the script look to see if the program is running already and if so close it down. I thought I'd found a pretty straightforward solution by getting the window list and checking for "Shift+Esc To Stop" then getting the window handle and doing a close on that but this doesn't seem to work properly all the time.
Is there a way of identifying what's running in the system tray and if it's found forcing it to shutdown? I've noticed that manually pressing "Shift+Esc" doesn't always work in stopping the executable from running either.
Thanks in advance!
Here's my not good enough attempt :
Code: Select all
GetWindowList>ListOfWindows
MessageModal>ListOfWindows
Position>Shift+Esc To Stop,ListOfWindows,1,Where
If>{%Where%>0}
Let>WIN_USEHANDLE=1
GetWindowHandle>Shift+Esc To Stop,nHandle
CloseWindow>%nHandle%
Else
MessageModal>Couldn't see it
EndIf