How do I debug the External Script command?
The script in the External Script command is executed by a script program installed on your Windows computer. To display error messages from the script program add a variable to the ‘Save console output to:’ field of the External Script command and add a ‘Text Box Display’ command to display the result.
When Macro Express Pro runs the External Script command, it writes the script to a file in your temporary folder. As it creates the script file it changes references to Macro Express Pro variables to the content of those variables. For example, if using VBScript, this:
will become this:
Once the script file is created, Macro Express pro calls the appropriate script program to run the script. As soon as the script finishes executing, the script file is deleted.
To verify that the Macro Express Pro variables are being passed correctly to your script you can look at the script file before it is deleted. The script file is located in your Temporary Folder and is named: mxescr###.vbs, where ### is a numeric value that increments each time the External Script command is executed.
For Macro Express Pro v 4.6.0.1 and later click Options, Preferences, General and the Misc tab. Uncheck the ‘Delete temporary external script file’ option.
- Run the macro containing the External Script command
- Examine the script file to verify that Macro Express Pro variables were transferred correctly.
When using Macro Express Pro v 4.5.0.1 and prior you will need to add a dialog to your script to keep the script from completing and deleting the script file. For example, for VBScript add a “msgbox” command in your External Script command. Then do this:
- Run the macro containing the External Script command
- Before closing the message box, copy the script file to another location.
- Examine the file to verify that Macro Express variables were transferred correctly.
– Applies to: Macro Express Pro