Collapse AllExpand All

11.4.1. Script Editor

To create a new script, select the NEW button. The following screen will appear:

Create New Script

Note

You may edit multiple scripts at the same time. To do so, open scripts for editing side-by-side.

When creating a new script, you are presented with the following options:

Name

Enter a name to identify the script. The name of the script must match the name of the screen the script will be used for. If the script name does not match the screen name, the script will not be used. Because a single screen may require more than one script, you may save multiple scripts having the same name. The order, notes, and content of each script will distinguish one from the other.

Notes

Enter a brief description of the script.

Order

Specify the order in which the script should be run. The script having the lowest number (i.e., "0") will be run first, and then following scripts will be run in consecutive order.

Package

Displays the name of the package the script belongs to, if any.

Enabled

Select to enable the script. If not selected, the script will be disabled. A disabled script will not be run when the corresponding screen is executed.

Script

Enter the content of the script using QtScript. You may type the script directly into this window, or you may import a script using the IMPORT SCRIPT button.

Line

The spin box in the lower left hand corner shows you the current line number—and allows you to jump to specific line numbers within the script.

Search

Enter a search term in the field and then select the FIND button to locate matches within the script.

The following buttons are unique to this screen:

FIND

Select to locate search term matches within the script.

EXTRACT WIDGETS

Select one of the following available options to extract widget nodes from the selected Script's XML source. Either option should insert var _foo = mywindow.findChild("_foo"); for the widgets in the screen. The information will appear above the main text of the Script.

INCLUDING LABELS

Selecting this option should include XLabel and QLabel widgets.

EXCLUDING LABELS

Selecting this option should exclude XLabel and QLabel widgets.

IMPORT SCRIPT

Select to import a script from your local file system into the database. This option is useful if you prefer to do your scripting using an external script editor. The script you import will be shown in the script window.

Warning

Every time you import a script file, the new script will replace the script which was shown in the script window previously.

EXPORT SCRIPT

Select to export the script shown in the script window to your local file system. You would use this option if you need or want to edit the script and do not have a copy stored locally on your system. Once exported, the script can be edited using an external editor—and then re-imported into the database using the import option. Whenever you import a script file, it automatically replaces whatever script was in place before it.