This article discusses the use of an independent message box program
for use when running multiple scripts concurrently under Macro Scheduler.

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.
Macro Scheduler has two message options, one modal, the other non-modal.
When MessageModal> is issued, processing halts until it is serviced.
Window and Time-Activated macros may still start while this message is serviced, but nothing else.

Even if you try to use the VBScript MsgBox function or a non-modal MacroScript Dialog you run into the same situation - You can't start anything from the Scheduler GUI - as your "Run Now" button is greyed out - both on the main menu and the right-click context menu.

To indicate progress without stopping is where the non-modal Message> command is handy.
Progress can be updated in this display while processing continues.
There is one caveat in this regard . . . there is only one, system-wide box and it is shared by all macros

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 program

To 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.
  • This allows me to create independent messages to indicate processing status - addressing Scenario 1.
  • Macros can be set to fire when a certain window opens.
    ( Macro properties, Run When, Advanced Options - When This Window Exists)
    I use InfoMessage to create a message for a "Window Activated" macro - addressing Scenario 2.

    Note: A Window-Activated macro will still fire under the Windows "lock workstation" conditions.
    Although you cannot send keystrokes to service the message, you can use the Macro Scheduler CloseWindow> command to remove the issued message.

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%
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%
Let>Caption=Schedule for %myDay% Complete
Run Program>%msched% %script% /TEXT=%myStatus% /TITLE=%Caption%

Called script code for InfoMessage macro above: - Download Link
// InfoMessage Routine.
// Used to generate stand-alone message.
// Call Macro Scheduler via Run Program
// Pass the location of this script
// Also pass MsgBox body and text.
// Example Call:
// Let>msched=C:\Program Files\Macro Scheduler\msched.exe
// Let>script=C:\Macro Scheduler\VB_Window.scp
// Let>myTitle=Hello World
// Let>myBody=A Macro Scheduler messaging aid.
// Run Program>%msched% %script% /TEXT=%myBody% /TITLE=%myTitle%
// Routine presents help message if no parameters
Function PopMsg(sBody, sTitle)

 If sBody = "%TEXT%" Then
    sBody = "This Macro expects two parameters:-"
    sBody = sBody & vbCrLf
    sBody = sBody & "/TEXT='body' and /TITLE='caption'"
 End If
 If sTitle = "%TITLE%" Then
    sTitle = "InfoMessage Help"
 End If

 MsgBox sBody,,sTitle

End Function


I hope you find this article useful.
Have fun with Macro Scheduler - it is an excellent tool !!

Robin Martin - May 2007

Robin is an independent consultant from Johannesburg, South Africa.
He has been working with the Macro Scheduler since late 1999