When the selected Python script is an Action-based script (like the example below), the right-hand panel of the Python Script Editor is used to add, customize and delete the Actions for that script.
Contents [Hide] |
In GainSeeker versions 8.4 - 8.6.1, each new Python script was designed as a series of Actions - each with its own setup interface.
In GainSeeker version 8.7, code-only scripts were introduced and became the system default. However, the Python Script Editor for GainSeeker versions 8.7 and later can still edit both types of scripts - Action-based and code-only.
For this reason, any existing Action-based scripts are not automatically converted to code-only scripts, and there may be cases where you need to - or want to - work with an Action-based script:
You already had Action-based scripts in place when GainSeeker was upgraded to version 8.7 or later
You imported Action-based scripts into GainSeeker
You downloaded Action-based scripts from the Python Script Library
You changed the System-wide setting so that new Python scripts will continue to be Action-based scripts, and you create a new script
If you prefer to work with code-only scripts, you can manually convert an Action-based script to a code-only script.
Please note that Action-based scripts in Inspections are more difficult to debug than code-only scripts, because breakpoints cannot be used.
To add an Action to the script, click Add Action and select the type of Action to add.
To edit an Action, click its Edit button. For information on editing each type of Action, click the links below:
Action |
Description |
|
Display a predefined form. The form can contain other controls such as text fields and web browsers. Note: The Display Form action is a Beta version that may be subject to change or discontinued in future GainSeeker versions. |
||
Specify the DMS data to retrieve for statistical calculations. This must be set before statistics can be calculated. |
||
Specify the SPC data to retrieve for statistical calculations. This must be set before statistics can be calculated. |
||
Write custom Python code to execute. |
||
Set a SQL query to execute. |
||
Configure a connection to a serial port. |
||
Set a condition to execute other actions. |
||
Interface with MTConnect agents. |
||
Interface with OPC servers. |
Actions are executed in the order listed.
To change the order of Actions, click an Action to select it and then click the Move Down or Move Up button.
To document your Action-based Python script, you can add a Description to each Action:
Action-based Python script |
The same Actions with Descriptions displayed |
To add or edit the Description for an Action, right-click the Action and then click Edit Description. Alternately, when you edit any type of action except Custom Code, the Action Editor window will also display the Description box where you can edit the Description for that Action.
To delete an Action, click an Action to select it and then click Delete Action.
You can save your script at any time by pressing Ctrl+S or by clicking the button on the toolbar. If you select another script or close the Python Script Editor before all changes have been saved, you will be prompted with the option to save changes.
To cancel unsaved changes, select another script or close the Python Script Editor and then click No when prompted.
If you want to create a code-only script from an Action-based script, run the debugger to display the Python code that is generated.
Then copy the Python code and paste it into a new code-only script.