Scripting Workbench
The Scripting Workbench is a separate panel which integrates all the interactive controls and tools necessary to manage all the aspects of script activity.
Script documents are loaded from the Scripting Explorer on the right using their context menu or a simple double-click
(as opposed to running them when in the main UI).
The Properties Window
The Properties window is used to edit interactively the parameters of the various commands. For example the following script code
With Process.Filter.MorphologicalCommands.Erode(NewMacro)
.Passes = 2
.Shape = MediaCy.IQL.Filters.mcMorphoShape.mcms3x3Square
.Run(doc1, doc1)
End With
can be edited interactively by choosing the proper option in the Properties panel.
The Properties window also allows selecting which variable each command uses for its input or output, this is important when building workflows as it defines the data flow represented by image documents such as "doc1" used in the previous example.
Finally, another important use of the Properties window is to define some command attributes such as those used to control command interactivity; the most important ones are:
Interactive: Forces the command to stop and "Prompt User In Imaging Workspace" as worded in the context menu.
Prompt: This is the text displayed in the command prompt dialog.
Filter User Input: If true, the user is only allowed to interact with the designated document but not with any of the other controls.
Scripting Workbench Ribbons
The Scripting Workbench
has two primary ribbons: Script,where
you will find the tools to create a macro script, and Edit, where
you can cut, copy, and paste portions of other scripts.
The Scripting Ribbon
The Scripting ribbon contains controls that are shared among the documents. These include Project, View, Run and Debug controls.
The Project group contains the following tools:
Record Macro/ Stop Recording: Clicking this button starts or stops recording your actions in a macro script file.
Pause Recording/Resume Recording: Clicking this button briefly starts or stops the macro recording.
Load: Click this button to load a saved macro script and run it in Scripting mode.
Edit: Click this button to leave Scripting mode and go to the Editing mode to make changes to your macro script.
References: Click this button to see a list of reference files.
The References dialog shows the current macro/module/project's references. References t type libraries may be added (checked) or removed (unchecked) and the relative proirity can be changed. Checked references are available to the current macro/module/project. Each checked reference is searched in order from top to bottom. A checked reference's name can be changed using the "Name" text box.
The View group contains these commands:
Double-clicking the Designer button displays your macro in Design mode.
Click the Code button to switch to Coding mode.
The current macro/module/project is edited/viewed in this area. Macros/Module/Projects that are not currently loaded may be edited. Changes to a line are automatically capitalized and highlighted when a different line is selected. Break points may be toggled on/off. A dot at the front of the line indicates a break point.
Immediate: Evaluate an expression, assign a variable or call a subroutine.
- Type "?expr" <Enter> to show the value of "expr".
- Type "var = expr" <Enter> to change the value of "var".
- Type "Set var = expr" <Enter> to change the reference of "var".
- Type "subname args" <Enter> to call a subroutine or built-in instruction.
- Type "Trace" <Enter> to toggle trace mode. Trace mode prints each statement in the immediate window when a macro/module/project is running.
Watch: List the variables, functions and expressions that are calculated and displayed.
- Each time execution pauses the value of each line in the window is updated.
- The expression to the left of "->" may be edited.
- Pressing Enter updates all the values immediately.
- Pressing Ctrl-Y deletes the line.
Stack: List the lines which called the current statement.
- The last line is the current statement. The first line is the first statement executed.
- Clicking on a line brings that macro/module/project into a sheet and highlights the line in the edit window.
Loaded: List all the currently active macros and loaded modules.
- These macros/module/projects are locked and can only be viewed (not edited).
- Clicking on a line brings that macro/module/project into a sheet and activates the sheet.
Object: The "Object" list shows all the objects for the current module. The "(general)" object groups all of the procedures which are not part of any specific object.
Proc: The "Proc" list shows all the procedures for the current object. Selecting a procedure that is not bold inserts the proper procedure definition for that procedure.
The Run group contains the controls for starting and stopping the macro player.
The Debug group contains tools for examining your macros line-by-line or step-by-step to find problems.
The Edit Ribbon
The Edit ribbon contains the commands for cutting, copying and pasting, as well as searching.
The Clipboard group contains the familiar Cut, Copy, and Paste commands.
The Search group lets you find specific macros or lines of code.
The Find command searches for a specific sting of code. Replace replaces one string of code with another.
My Macros looks for a specific macro among all the macros stored on your computer.
Clicking the App Center button takes you to the App Center, which contains specially crafted applications designed to optimize and automate specific image analysis workflows.
The Comment group lets you add or remove comments from specific lines of code.
The Report Tool Ribbons
When you are working with report templates, additional ribbons are provided that contain the report tools options and controls.
Refer to the main Image-Pro help file for more information on these ribbons.
Scripting Workbench Settings
Scripting Workbench options are displayed in the Properties panel when “My Projects” is selected (see below). The Scripting Workbench options can also be accessed with the Options button of the Workbench’s File menu. These options gather all global settings used by the Scripting Workbench including editing tool configuration and display selections.