Determine if a Compiled Script is running
Moderators: JRL, Dorian (MJT support)
Determine if a Compiled Script is running
The goal is to create an opening menu that would display a button to turn on a compiled macro if it is off and off if it is on.
This macro would be monitoring a folder and have no windows. (Therefore WaitWindowOpen would be out)
I thought of just creating a text file when it is turned on and checking to see if it exists (deleting it when the utility is turned off); however, if the computer shuts down unexpectedly the file would still be there with no way to turn it back on.
So, I need a way to see if an application is running. I thought of GetWindowProcess but again there is no Window Name just an application name
This macro would be monitoring a folder and have no windows. (Therefore WaitWindowOpen would be out)
I thought of just creating a text file when it is turned on and checking to see if it exists (deleting it when the utility is turned off); however, if the computer shuts down unexpectedly the file would still be there with no way to turn it back on.
So, I need a way to see if an application is running. I thought of GetWindowProcess but again there is no Window Name just an application name
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
To see if a process is running:
http://www.mjtnet.com/forum/viewtopic.php?t=1652
Terminating processes:
http://www.mjtnet.com/forum/viewtopic.php?t=1779
http://www.mjtnet.com/forum/viewtopic.php?t=1652
Terminating processes:
http://www.mjtnet.com/forum/viewtopic.php?t=1779
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Determine if a Compiled Script is running
This situation is similar to the previous post.kpassaur wrote:however, if the computer shuts down unexpectedly the file would still be there with no way to turn it back on.
So, I need a way to see if an application is running. I thought of GetWindowProcess but again there is no Window Name just an application name
To avoid this problem, you could add a dialog to your compiled macro and give it a unique window title. Then you could check for the existance of that window from the Main script and offer the appropriate button to either turn on or turn off the process.
The dialog could be very simple, it could just display a message "process xyz running". You could add a button to the dialog to offer to turn off the process if you want. If you don't want the user to be able to change the dialog directly, you could remove all controls or even make the dialog window invisible.
Even if invisible, the IfWindowOpen> command would still be able to detect it and you would know if the process (compiled macro) is running or not.
Marcus, what is the code required to make a dialog "invisible"?
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

Keith,
If you haven't resolved this yet, here is a script with a dialog containing a single button that will toggle notepad on and off. The "flag" is the name of the button so there is no external settings, files, etc. to be concerned about. As the application being started and stopped toggles, so does the button name. By testing the button name we can know the state of the application. Any application or executable could be substituted for “Notepadâ€Â
If you haven't resolved this yet, here is a script with a dialog containing a single button that will toggle notepad on and off. The "flag" is the name of the button so there is no external settings, files, etc. to be concerned about. As the application being started and stopped toggles, so does the button name. By testing the button name we can know the state of the application. Any application or executable could be substituted for “Notepadâ€Â
Thanks for the above script JRL... a great addition to the snippet collection. 

jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

Thanks JRL, that should work. However, if anyone wants to try hiding or unhiding windows, there's more info here: Is it Possible to Unhide a Hidden Window? In that post, there is the following...JRL wrote:What I've always done to make a dialog (or any other window) "invisible" is move it to a location far from view. Something like this is usually adequate
MoveWindow>Window Name,-10000,-10000
That would certainly be useful... any news on that Marcus?mtettmar wrote:We do intend to add a function to IEAuto.DLL to HIDE the IE window altogether. IE offers a property to make it visible or not, so we can easily expose that method and hide it.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
That was added ages ago. Note the ShowIE function.jpuziano wrote:That would certainly be useful... any news on that Marcus?mtettmar wrote:We do intend to add a function to IEAuto.DLL to HIDE the IE window altogether. IE offers a property to make it visible or not, so we can easily expose that method and hide it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Thanks Marcus!mtettmar wrote:That was added ages ago. Note the ShowIE function.

jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
