Determining if Macro Scheduler currently running
Moderators: Dorian (MJT support), JRL
Determining if Macro Scheduler currently running
I have an Excel macro that runs Macro Scheduler and am in the process of finalizing the code. One thing that I would like to do is to stop the Excel macro and issue a message to the user if Macro Scheduler is currently running as I do not want to run any of my scripts if it is. Anyone know to do this. I have tried Windows API for findwindow but it fails to work. Thanks in advance.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
A few thoughts off the top of my head........
Would a Macro Scheduler Message Modal Box help out?
Use it in conjunction with Let>MSG_STAYONTOP=1
You could also use the Macro Scheduler to minimize the Excel window, and temporarily rename the EXCEL.EXE file until the Macro Scheduler routine is completed.
None of these are foolproof (nothing ever is!), just trying to set up a quick nuisance barrier.
Would a Macro Scheduler Message Modal Box help out?
Use it in conjunction with Let>MSG_STAYONTOP=1
You could also use the Macro Scheduler to minimize the Excel window, and temporarily rename the EXCEL.EXE file until the Macro Scheduler routine is completed.
None of these are foolproof (nothing ever is!), just trying to set up a quick nuisance barrier.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
To armsys,
No I really don't want to terminate Macro Scheduler if the Excel macro detects that a Macro Scheduler script is running. I just want to detect it's existence and notify the user to shut it down. This will make the user investigate why a script is still running. Perhaps a previous execution of a script missed it's timing has stalled. I may not be able to successfully detect the running script and will just have to educate the user to make sure they don't see Macro Scheduler showing in the taskbar but you know how users can be---they will forget and kick the Excel automation off and it will get all mucked up if a previous one did not complete to a normal end.
To bob hansen,
I guess I'm dumb. I can't see how your response will help excel detect that a Macro Scheduler script is running. Can you explain further?
Thanks to you both for your responses
No I really don't want to terminate Macro Scheduler if the Excel macro detects that a Macro Scheduler script is running. I just want to detect it's existence and notify the user to shut it down. This will make the user investigate why a script is still running. Perhaps a previous execution of a script missed it's timing has stalled. I may not be able to successfully detect the running script and will just have to educate the user to make sure they don't see Macro Scheduler showing in the taskbar but you know how users can be---they will forget and kick the Excel automation off and it will get all mucked up if a previous one did not complete to a normal end.
To bob hansen,
I guess I'm dumb. I can't see how your response will help excel detect that a Macro Scheduler script is running. Can you explain further?
Thanks to you both for your responses
Hi Guest,
Thanks for posting your Macor Scheduler issue here.
First, you run tasklist.exe to produce a text file listing the names of all currently running processes.
/*--- Run TaskList.exe ---*/
run>c:\windows\command\tasklist.exe >c:\temp\Process.txt
The location of your TaskList.exe may vary.
If Macro Scheduler is currently running, you can see "Msched.exe" is somewhere on the list. Instead of manual visual scanning, of course, you can automate the detection by Macro Scheduler by reading the text file line by line.
Keep posting your technical issues here. Thanks.
Thanks for posting your Macor Scheduler issue here.
First, you run tasklist.exe to produce a text file listing the names of all currently running processes.
/*--- Run TaskList.exe ---*/
run>c:\windows\command\tasklist.exe >c:\temp\Process.txt
The location of your TaskList.exe may vary.
If Macro Scheduler is currently running, you can see "Msched.exe" is somewhere on the list. Instead of manual visual scanning, of course, you can automate the detection by Macro Scheduler by reading the text file line by line.
Keep posting your technical issues here. Thanks.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I was thinking that you wanted a user to know if Macro Scheduler was running. I was not addressing it from the point of Excel knowing it was running.
If Excel calls up a Macro Scheduler macro, have the MS macro use ResizeWindow> to put up a LARGE MessageModal> Box that will not go away.
In my earlier message I mentioned using MessageModal> but that was an error. I meant to suggest using
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1
Perhaps the message could say "Press SHIFT-ESC to stop Macro Scheduler macro". This message box would remain on top of Excel program and would only go away when MS macro replaced it at end of macro routine.
If macro needs other messages, perhaps put the SHIFT-ESC message at the top of these other messages using %CRLF% as needed.
Instead of CENTERED, you could put in a loop to keep moving the MessageBox's position to provide additional visual attention.
You could also use PlayWav> to have an audible notification along with the MessageBox. (You would have to make a loop to repeat its playing).
Make the movement of the window and/or the sound file a sub-routine.
Again, these thought were to notify a real user that a MS macro was running.
"The trouble with making something 'idiot-proof' is that the idiots are so smart". ---(Source unknown). They keep finding new ways to do something.
Hope this clarifies my thoughts.......good luck....
If Excel calls up a Macro Scheduler macro, have the MS macro use ResizeWindow> to put up a LARGE MessageModal> Box that will not go away.
In my earlier message I mentioned using MessageModal> but that was an error. I meant to suggest using
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1
Perhaps the message could say "Press SHIFT-ESC to stop Macro Scheduler macro". This message box would remain on top of Excel program and would only go away when MS macro replaced it at end of macro routine.
If macro needs other messages, perhaps put the SHIFT-ESC message at the top of these other messages using %CRLF% as needed.
Instead of CENTERED, you could put in a loop to keep moving the MessageBox's position to provide additional visual attention.
You could also use PlayWav> to have an audible notification along with the MessageBox. (You would have to make a loop to repeat its playing).
Make the movement of the window and/or the sound file a sub-routine.
Again, these thought were to notify a real user that a MS macro was running.
"The trouble with making something 'idiot-proof' is that the idiots are so smart". ---(Source unknown). They keep finding new ways to do something.
Hope this clarifies my thoughts.......good luck....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hi,
how about this:
Script A
Script B
As long as script A hasn't finished correctly script B won't start.
You can work as well with notify files: WLN> --> DeleteFile> --> IfFileExists>
how about this:
Script A
Code: Select all
EditIniFile>C:\Status.ini,MSched,Active,YES
.
.
.
Label>Done
EditIniFile>C:\Status.ini,MSched,Active,NO
Script B
Code: Select all
ReadIniFile>C:\Status.ini,MSched,Active,status
IF>status=YES, End
.
.
.
You can work as well with notify files: WLN> --> DeleteFile> --> IfFileExists>
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Thanks Lumumba
I like that simple ini file solution.
I don't think it is going to solve the problem that "guest" is concerned about, but it gives me some ideas as solutions for some other situations.
Thanks for tickling the noodles.
I like that simple ini file solution.
I don't think it is going to solve the problem that "guest" is concerned about, but it gives me some ideas as solutions for some other situations.
Thanks for tickling the noodles.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Don't forget you can go to Tools/Options and deselect 'Allow Multiple Instances'. Then Excel cannot run Macro Scheduler if it is already running.
MJT Net Support
[email protected]
[email protected]