Summary: This article discusses the use of an independent message box program for use when running multiple scripts concurrently under Macro Scheduler. Overview: As the complexity of your automation effort increases, you may encounter situations where macros are triggered by various independent different events such as schedule time, window dialog or file creation. Under these conditions, your messaging strategy may need to be revised.
Scenario 1: - Standalone process For situations where an indication of process completion is required, while not stalling the scheduler or overwriting previous notifications, there are a number of options, including updating a database, writing messages into a log-file or an INI file entry. In many situations, it would be much easier to simply pop up a message which remains visible after the macro has completed, and does not stall the Scheduler waiting for a response. One of my clients asked for such a message - to indicate daily reporting completion status. The same macro runs every day and when they arrive for work on Monday morning, they wanted to see the run status for Friday, Saturday and Sunday on screen. Scenario 2: - Macro Initiation I have often come across situations where it would be useful to be able to start another macro. For example, during overnight processing, when the available disk-space falls below a certain level, to initiate an independent archive process. The Macro> command is the normal way to achieve this, but the calling macro waits for the called macro to complete. If you want to run another asynchronous process, you need some other way to trigger a new macro. Simple Solution: External message programTo solve both these scenarios, I needed something that would exist externally to Macro Scheduler - some process that could be called via the "fire-and-forget" Run Program> command.Now, I could use Macro Scheduler itself, creating another instance by using the command-line interface optionto launch a script in a new, independent instance of the Scheduler . . . Run Program>msched MsgScript /TEXT=Message /TITLE=Caption but that seems like overkill when all I wanted was a small very simple, standalone .EXE that issues a message, so I created one.
My language of choice was C++ to avoid any system library dependencies and having a tiny resource requirement - simply place it in a folder of your choice. When run without any parameters, it will display a messagebox with syntax help. Executables and full source code (for the free DevC++ compiler) are available from our Download page Example code when using the external program : Let>myStatus=Completion Status : %MaxCC% DayOfWeek>myDay Run Program>C:\MIS\InfoMessage.exe %myStatus%, Schedule for %myDay% Complete For completeness, example code when using a second instance of MSched : Let>msched=C:\Program Files\Macro Scheduler\msched.exe Let>script=C:\Macro Scheduler\InfoMessage.scp Let>myStatus=Completion Status : %MaxCC% DayOfWeek>myDay Let>Caption=Schedule for %myDay% Complete Run Program>%msched% %script% /TEXT=%myStatus% /TITLE=%Caption% Called script code for InfoMessage macro above: - Download Link
I hope you find this article useful. Robin is an independent consultant from Johannesburg, South Africa. |