The Run window displays information about the currently running script. In the Run window you can manually control script execution, view script output as it is generated, see and modify variables, and follow the progress of the script with animation or tracing.
- The Run Window Toolbar
- The Script Frame Pop-Up Menu
- The Script Display Pane
- Dynamic Breakpoints
- The Log Pane
- The Ad Hoc Do Box and Do Button
- The Variable Watcher Pane
- Add/Remove List and Property List Items Buttons
The Run window toolbar contains buttons and menus for the tasks you can perform while your script is running. When you change the width of your Run window, the buttons and menus available on the toolbar change. If you see the >> button, it indicates there are more options. When you click >>, a menu displays showing the buttons and menus that do not fit in the Run window at its current size.
Run Script/Abort Script:
The Run Script button reruns the last script that was run, or the entire script from which a selection was run. While a script is running, the Run Script button becomes Abort Script.
While a script is running (and not paused), you cannot perform any manual actions in the Viewer window, or open and close VNC connections.
The Run Selection button executes only the selected part of a script. The selection does not have to include an entire line of code, but it must be syntactically complete and executable. (For example, if you select the beginning of an if block, you must select all the way through the endif statement.)
You can run the selection in debug mode by Alt-clicking (Option-clicking on Mac) the Run Selection button. This loads the selection for execution, but immediately pauses it, allowing you to step through it line-by-line to closely follow its execution.
Pause / Continue
The Pause/Continue buttons allow you to pause and continue execution whenever a script is running.
When the script execution is paused, you can perform additional operations:
- Type commands in the Ad Hoc Do Box. (See The Ad Hoc Do Box and Do Button section below.)
- Use the debug mode tools: Step Into, Step Over, and Step Out. (See below.)
- Interact with the Viewer window in Live Mode.
The Step Into button executes the next line of a script, then pauses. If this line calls another script or handler, the script "steps into" the first line of the called script or handler before pausing again.
Like Step Into, Step Over executes the next line of the script, then pauses. However, if this line calls another script or handler, that script or handler runs in its entirety, "stepping over" it to the next line of original script before pausing again.
During the execution of the script or handler that is stepped over, you can click Pause to regain control of the execution before the Step Over command has finished.
Step Out executes all the remaining lines in the current script or handler, then pauses. (Using Step Out on your initial handler is the same as clicking Continue.)
During the execution of the code being stepped out of, you can click Pause to regain control before the Step Out command has finished.
The Edit Script button opens the Script Editor for the script that is currently in the Run window. If you have text selected when you click this button, Eggplant Functional attempts to automatically select the same text in the Script Editor. (If the selected text has been edited since the last run, Eggplant Functional might not be able to find it in the Script Editor.)
The Show Suite button opens the current script’s suite in the Suite window.
The Show Results button opens the last recorded results for the current script, in the Results pane of the Suite window.
The Script Animation selection box highlights the current line of code in the Script Display area of the Run window while the script is running. You can change animation settings at any time with immediate effect, including while a script is running.
Animations cause scripts to execute more slowly, because Eggplant Functional is doing more work at the display level. You can improve script execution speed by turning off all animations when you are not debugging.
The Animation options are available as a selection box or pop-up menu, depending on how wide your window is. If it is wide, you see the selection box. If it is narrower, you see it as a pop-up menu on the >> menu.
Animation Off: The Display area of the Run window does not update as the script runs; only the initial handler for the script is shown, unless the execution is paused.
Animate Calls: The Run window shows each script or handler as it is called, but it does not highlight each line of the script.
Animate All: The Run window highlights each line of each script or handler while it runs.
The >> button
The >> button indicates that more options are available on the Run window toolbar. When you click it, a menu displays showing the buttons and menus that do not fit on the Run window toolbar at its current size. When your Run window is wider, more of the buttons and menus show on the toolbar. When your Run window is narrow, more of the buttons and menus show on the menu.
The Script Tracing menu is available as a selection box or pop-up menu, depending on the width of your window.
The Script Tracing menu on the Run window toolbar
Tracing causes Eggplant Functional to "echo" information about what the script is about to execute to the Log Area in the Run window. This is similar to animation, but it allows you to review all of the code that is executed during the script run, interspersed with logged output. This can provide more context when debugging a script.
You can change trace settings at any time with immediate effect, even while a script is running.
Tracing Off: Only standard log messages are displayed in the Log Area of the Run window.
Trace Calls: The Log Area of the Run window displays a message as it enters and leaves each script or handler.
Trace All: The Log Area of the Run window displays every line of each script or handler prior to executing it.
The Show Variables menu provides options for the Variable Watcher feature. The Variable Watcher feature (Variable Watcher Pane) described below allows you to see and modify the effective SenseTalk variables while your script is paused or running.
The Show Variables menu is available as a selection box or pop-up menu, depending on the width of your Run window.
The Show Variables menu on the Run window toolbar
The Show Variable menu options are as follows:
Never: This option disables the Variable Watcher and hides the Variable Watcher pane on the Run window.
When Paused: This option enables the Variable Watcher and shows the pane in the Run window. With this setting, you can only see and modify the variables when a script is paused.
Always: This option enables the Variable Watcher and shows the pane in the Run window. With this setting, you can see and edit the variables both while a script is running and while it is paused.
2. Script Frame Pop-up Menu
The Script Frame pop-up menu displays the handlers that are being executed, listed in the reverse order in which they are called.
When script execution is paused, you can select a different frame from this pop-up menu to view it in the Script Display area and see which line it is currently executing. This also sets the context for commands typed into the Ad-hoc Do Box. For example, if you want to output the value of a variable that is present only in the script handler that started your execution, you must make sure to select the very bottom frame, numbered “1.”
3. Script Display Pane
The Script Display pane is the top half of the Run window. When script animation is turned on, the currently executed handler is displayed here. (When script animation is turned off, the initial handler is displayed, but it is only updated when the script is paused.)
4. Dynamic Breakpoints
Dynamic breakpoints are markers that cause a script to pause for debugging at designated points. They can be added or changed at any time, even while the script is running.
You can set a dynamic breakpoint in the Run window by clicking in the column to the left of the Script Display area. A black triangle appears next to the line, denoting the breakpoint. (You can also set a breakpoint at your insertion point in the script by choosing Run menu>Set Breakpoint.)
You can move a breakpoint by dragging the triangle to another line in the script, or remove it by dragging it out of the column.
The Log pane is the lower half of the Run window. As the script runs, the Log pane displays the following information:
- The same information that is recorded in the script’s permanent log. See the Results pane, in The Script Editor.
- The output of Put commands that have no specific destination. See the ScriptTracing Eggplant Functional global variable.
- Output from commands entered in the Ad Hoc Do Box.
You also can view this information in the Output/Script Checker pane of the Script Editor.
The Ad Hoc Do Box (AHDB) allows you to modify a script while it is running. You can enter SenseTalk code in it to assign new variable values, execute commands, or call other scripts. It also keeps a history of everything you enter, so you can rerun previous entries. AHDB is located at the bottom of the Run window and is always shown.
Using the Ad Hoc Do Box
Entering SenseTalk Code
To use AHDB, simply enter the SenseTalk code you want in the box as follows:
- Type your first line of code in the box. For each additional line, press the alt + keys on Windows and Linux or Option + keys on Mac. You can enter up to 10 lines and the box will automatically expand to accommodate them. Use the arrow keys to move between lines when you have multiple lines.
- Click Do or press Enter to execute the code. Note that if you click Do while your script is paused, your code executes and then pauses again. You need to click Continue to continue running your script. If you click Do while your script is running, Eggplant Functional finishes the line of code it is currently processing, and then executes the code you entered and continues running the script.
Important! Pressing Enter in AHDB has the same effect as clicking the Do button—it executes the code. It does not function like a carriage return for you to enter a new line.
Working with the History
AHDB also provides a history option. This enables you to return to code that you previously ran and run it again. The history is saved for the duration of the Eggplant Functional session. It will be cleared when you restart.
To scroll through the History, use Alt + the up and down arrow keys on Windows and Linux, or Option + the up and down arrow keys on Mac.
The Variable Watcher, when it is enabled, is the pane on the right-side of the Run window. The Variable Watcher enables you to display the effective variables and edit their values while your script is paused or running. You can also configure the types variables you see: local, global, universal or any combination of them. For more about using it, see the Variable Watcher.
Note: The Variable Watcher does not continue to display variables after a script finishes running.
The plus (+) and minus (-) buttons below the Variable Watcher pane enable you to add or remove an item from a list or property list in the Variable Watcher while your script is running or paused. For more information about using lists and property lists, see Lists and Property Lists. For more information about using the Variable Watcher, see Variable Watcher.