Editor Menu - Debug
Test Run Macro
Press the Test Run button on the tool bar, press F9 or click through the menu option to test run the macro open in the Editor. This is a quick way to determine if any fine tuning is necessary. Before the macro starts, the Start Debugger in a Different Window dialog is displayed. Choose whether to test run the macro in a specific window or leave focus as is.
Which window to use will depend on the first line or two of the macro.
For example if the first line of the macro types text, then select a window from the list where the text can be inserted. The macro needs to know where to type the text during the debug testing. With the (Don't Switch Focus) option the macro will attempt to insert the text into Macro Express, since this is the window that currently has focus.
If the macro does not use mouse clicks or type text before opening a program or window, then choose the (Don't Switch Focus) option. Or if the first line of the macro is to open a program or window and then insert text, use the (Don't Switch Focus) option as the macro will determine the focus.
Turning off the Switch Focus menu option, discussed below, will run the macro without opening the Start Debugger in a Different Window dialog.
Pause (Script Editor Only)
While the macro is running in test run mode click on Debug > Pause or the Pause button on the tool bar. This pauses the test run of the macro. Click on the Test Run button to resume.
Stop (Script Editor Only)
While the macro is running in test run mode, click on Debug > Stop or the Stop button on the tool bar. This stops the test run of the macro.
Toggle Breakpoint (Script Editor Only)
Highlight a line in the script to set as a breakpoint and then select the Toggle Breakpoint menu option or press CTRL B. When test running a macro, the macro stops at the set breakpoint. During the break, it's possible to view the Variables window (Debug > Show Variable Values from the menu) and verify that the variables are being populated correctly.
Press the Test Run Macro button to resume until finished or until the next breakpoint. To remove a Breakpoint, highlight the command in the script and press CTRL B or click on the menu item Debug > Toggle Breakpoint.
üNote: The breakpoints are saved when the macro is saved and are available for use the next time the macro is run through the debugger. The breakpoints are ignored when running the macro outside of the debug mode.
Step Options (Script Editor Only)
Select the Step Over or Step Into option to test run the macro and have the macro pause after each line in the script. Pressing the F8 or F7 button causes the macro to run the next command and so on, until the macro has finished. This simplifies the process for debugging a macro.
Step Into - F7
If the script contains a Macro Run command, pressing the F7 key or clicking on the Step Into button loads the script of the called macro into the editor and steps through each line of the called macro script.
Step Over - F8
If the script contains a Macro Run command, pressing the F8 key or clicking on the Step Over button plays the called macro at the appropriate point in the script, but does not step through the called macro.
Switch Focus (Script Editor Only)
When using the F7 or F8 key to step through a macro, it is necessary to click the mouse to return focus to the Editor between each step. In order to avoid this, select the Switch Focus option. The focus returns to the prior window when stepping through a macro.
Save Before Test Run
This option saves the macro script first and then performs a test run of the macro.
Show Variable Values
The values of the variables are displayed in a separate window when debugging a macro. Use this window to determine that the correct values are being saved to the variables. The window displays the variable type, variable name and the corresponding value.
Click on Debug, Show Variable Values or press the F5 key to open a window similar to the one displayed below. Give focus back to the Script Editor, press F7, F8, F9 or click on the Test Run button to run the macro in a test mode and watch the window populate with the variable values. Running in test mode again clears the values and repopulates the window with new data as the macro runs.