Debug Window

by Marjo Martinez, in Tech Talk, posted 8/13/07

The Debug Window of the AutoMate Task Builder supplies a large amount of information about the task being constructed. Its purpose is to assist a developer to properly diagnose a task that generates an error or is generally not running properly. It provides a simple means to examine the contents of variables, inspect the states of any watches that were set, view labels and attachments or observe what each step may (or may not) have done during task execution. The Debug window contains six views which are separated by tabs. This article will provide a comprehensive description of each available Debugging tool.

Output Window
The 'Output' view contains real-time information about the currently running task. As a task executes, each step is logged to the 'Output' window with debug information, such as the current step number, a description of the step and the results of the step. If a particular step fails, a detailed description of the generated error will appear. Furthermore, each step may have its own debugging information that is written to the 'Output' view. For example, the 'Copy Files' action will output the name of each file being copied during task execution. The 'Output' window can contain invaluable information about what a task is currently doing at any given time. Additionally, because it contains extended step information, the 'Output' window usually supplies the best indication of why a particular step failed.

The contents of the 'Output' window can be copied to the clipboard by selecting "Copy" from the right-click menu. The contents can then be pasted into any application or window that accepts standard text. To clear the contents of the debug window, select "Clear" from the right-click menu. To save the contents of the output window to a standard text file, choose "Save As..." from the right-click menu.

Variables Window
The 'Variables' window displays all variables that exist in a task, along with the initial value (the value that the variable is first set to in the 'Create Variable' step), the current value (the value of the variable at the current executing step), and the variable's description. The current variable value is updated in the display when a task is paused, stopped, or when a breakpoint is encountered. This is an ideal debugging option to use when you want to confirm the value of a particular variable. It's especially helpful when a variable's value changes numerous times during task execution. Additionally, the 'Variables' view has the ability to explore within datasets and arrays by right-clicking on a variable name and choosing "Inspect." In this manner you can see exactly what is inside the array or dataset at runtime.

Variable names can be changed within the 'Variables' window by clicking the variable name and either right-clicking and selecting "Rename," or by pressing the F2 key. Changing the variable name in this manner will change the variable name of the corresponding 'Create Variable' step of the task. Variables can be quickly added to the task by right-clicking in the 'Variables' view and selecting "Add." This procedure, in fact, adds a new 'Create Variable' step to the top of the task. Variables can also be deleted by selecting the variable and pressing DELETE on your keyboard or right-clicking and selecting "Delete" or "Delete All". Note that deleting a variable from the 'Variables' window also causes the associated 'Create Variable' step(s) to be removed from the task.

Breakpoints Window
The 'Breakpoints" window displays all breakpoints in the current task. Breakpoints provide a means of adding a pause or "break" to a task at specific steps to allow a user to examine variable states and to better assess task flow. The 'Breakpoints' view contains one column that displays the line number where the breakpoint is active. Once the task is paused at a breakpoint, the user can 'Step' through the task (which executes one step at a time each time the 'Step' button or F9 key is pressed) or continue the task from that point by pressing the 'Run' button again. A breakpoint is indicated by an icon with an exclamation point located on the left side of the step (next to the step number).

A user can select a breakpoint to go to from the list of available breakpoints by selecting "Goto" from the right-click menu. Additionally, there is an option to remove an individual breakpoint or all breakpoints by selecting "Remove" or "Remove All" from the right-click menu.

Watches Window
The 'Watches' window shows all the "Watches" set on the task. A Watch can simply be a variable name to be examined or elaborate expressions that are re-evaluated as a step executes. The 'Watches' window provides an excellent means of testing and debugging variable or task states while a task is running. In larger tasks, where AutoMate 'Basic Script' actions, multiple Set Variable steps, or other more complex task steps are involved, Watches are invaluable for seeing where and how variable values change.

To add a variable to the 'Watches' window, from the task steps, right-click the 'Create Variable' step of the variable to watch and select "Add to Watchlist." After each step, the watch list will be updated with the variable's value.

Changing an existing watch can be done within the 'Watches' window by entering the modified expression into the drop down, then selecting the expression to be modified from within the watches list and selecting "Change" from the right-click menu. Additionally, to remove a watch, select the watch to be removed and press the DELETE key, or select "Delete" from the right-click menu. To delete all watches, select all the watches and press the DELETE key, or select "Delete All" from the right-click menu.

Attachments Window
The 'Attachments' view lists all files that are attached to the current task. Attachments allow a file of any type to be embedded within a task so that third-party elements can be included with a task. This allows any files that rely on the task to be easily transferred, exported or deployed and any attached files will be included along with the task. At runtime, the attachments are automatically unpacked to a temporary files directory, where they can be accessed from the task.

For example, if a task that plays a .wav file to alert the user of a particular event was deployed to a remote AutoMate installation, attaching the file to the task will guarantee that the sound file will be present on the system that the task was deployed to.

To attach a file to the 'Attachments' window, right-click anywhere inside the window and select "Add." Browse to the file you wish to attach and click "OK." The full path to the file will be shown in the attachment window.

To use an attachment in your task, use the filename (without the path) of the attachment.
For example, if you attach the sound file "C:\MySounds\ScreamingBoar.wav", you would refer to this file in a 'Play Audio' action as "ScreamingBoar.wav."

Note that attachments can be of any type and size. However, the size of the task file expands with the size and number of attachments. On average, the size of the task file will increase by twice the size of each attachment due to the MIME encoding method.

Labels Window
The Labels Window displays all Labels included in the task. Labels are points in a task which are labeled with a specific name and are created using the 'Label' action. This action is used in conjunction with the 'Goto' action or 'On Error Goto' option (located in the 'On Error' tab) which sends task flow to the label indicated. The 'Goto' and 'Label' actions are generally used to direct task execution to a different point of the task.

The 'Labels' Window' is a convenient method to verify Label names and locations during task execution. It's especially useful when numerous "Goto" and "Label" actions are included in a task. This window is automatically populated with the Label name and step number upon creation of the corresponding action.

NOTES:
Each Debug Window can be individually removed and floated by holding the left mouse button over the page tab and dragging it out of the Debug Window. Additionally, selecting "Stay on Top" from the right-click menu causes the view to remain on top of all other Task Builder windows. Selecting "Dockable" allows the view to be docked along the bottom of the Task Builder below the Steps Window. If "Dockable" is not selected, the window will not dock to any other views or windows. If you want to revert back to the default view, simply go to the 'View' menu and select 'Reset Interface.'