How Can We Help?
< All Topics

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:

vbsString = “%MacExpString%”

will become this:

vbsString = “Pass this to VBScript”

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 and later click Options, Preferences, General and the Misc tab. Uncheck the ‘Delete temporary external script file’ option.

  1. Run the macro containing the External Script command
  2. Examine the script file to verify that Macro Express Pro variables were transferred correctly.

When using Macro Express Pro v 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:

  1. Run the macro containing the External Script command
  2. Before closing the message box, copy the script file to another location.
  3. Examine the file to verify that Macro Express variables were transferred correctly.

– Applies to: Macro Express Pro