Low cost solutions to Data Acquisition and Control, with a snap.
Data Sheets and Application Notes Product Warranty Return Policy Privacy Notice How to Order Company Profile

Scripts

One of the more powerful features of ModCom is the ability to write custom scripts which act like sub-programs that run in the background of ModCom. A Script is a list of functions and/or logical expressions that will execute sequentially during run-time when the Script is called by other objects such as a Push Button, a Conditional, or even another Script. And because a Script can call another Script, allows the programmer to assemble groups of commonly used tasks which can serve as subroutines of other complex Scripts. A Script can also be setup to run in a loop which will continue to cycle until a logical expression evaluates to TRUE or some other object within ModCom halts it. See "Script Loops" at the end of this chapter for some important information.

A master Script can also be triggered automatically each time the run-loop is started by listing it in the Initialization setup box. This Script can be used to initialize certain Screen Objects, setup the Data Modules by transmitting commands to them, and start any Script loops that you wish to have running in the background on a continuous basis.

To create or edit an existing Script, select "Scripts" in the <Run-Loop> menu which will bring up the Script List dialog box. The following is a summery of the options available in this dialog box:

Script List Dialog Box:

Selection List: This is the list of current Scripts if any have been created. This field will be blank if you have not yet defined any Scripts for this project.

Modify:

New: Click on this button to add a new Script to the project. This will bring up another dialog box which can be used to create the specific steps of the Script. See "Script Configuration" below for more details.

Edit: To use this option, a Script must first be selected from the list at the left. Click on this button to edit the selected Script. This will bring up another dialog box which can be used to edit the individual steps of the Script. See "Script Configuration" below for more details.

Delete: To use this option, a Script must first be selected from the list at the left. Click on this button to delete the selected Script from the project.

Copy: To use this option, a Script must first be selected from the list at the left. Click on this button to copy the selected Script and place it on the clipboard. This will then enable you to open another project and paste this Script into it.

Paste: To use this option, a Script must first be copied and placed on the clipboard. Click on this button to paste the current contents of the clipboard into the project.

Export: Click on this button to export all of the Script configurations to a file named "Script.txt". This file can then be imported into another project, used for documentation, or edited using a text editor. Note, if editing make sure to maintain the same format as shown in the original file including all blank lines in the body as well as at the start and end of the file.

Import: Click on this button to import the Script configurations from the file named "Script.txt". Note, any pre-existing Scripts in this project will be deleted.

Script Configuration Dialog Box:

ID Label: Type in a label that will be used for identification by other objects within ModCom when starting or stopping this Script.

Available Functions: This box lists all of the Functions available to be used in the Script. Select an item and then click on "Add Step" to add it to the step list of the Script. Then click on "Edit Step" to edit the properties of that particular function.

Step List: This box lists all of the individual steps or events which make up the Script. When the Script is called (or started) by another object within ModCom, the steps will be executed from top to bottom. Use the modify buttons at the right to edit each step or to move it up or down in the execution order.

Modify:

Add Step: To use this option, a function must first be selected from the "Available Functions" box on the left. Click on this button to add the selected function to the step list of the Script.

Edit Step: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to edit the selected step. This will bring up another dialog box which can be used to edit the properties of that particular step. See "Script Step Properties" below for more details.

Delete Step: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to delete the selected step from the Script.

Copy Step: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to copy the selected step and place it on the clipboard. This will then enable you to paste this step at multiple positions in the execution order, or to open another project and paste this step into it.

Paste Step: To use this option, a step must first be copied and placed on the clipboard. Click on this button to paste the current contents of the clipboard into the project. You can then use the "Move Up" and "Move Down" buttons to position the step appropriately.

Move Up: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to move the selected step one place up in the execution order.

Move Down: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to move the selected step one place down in the execution order.

Script Step Properties:

Step Function:

Depending on the particular function, one or more edit fields will appear and should be used to define the specific properties required for the operation of this function. Such as entering in data and/or Screen Object names, etc. Refer to the function's definition for details. Note, the edit fields in this dialog box supports variables.

Script Loops:

It is perfectly legal to have one or more Scripts running in a loop in the background to perform some kind of ongoing operation behind the scenes. When a Script is running in a loop, at the end of each complete cycle, ModCom exits temporarily to take care of other business such as updating the Screen Objects, processing the Conditionals, logging data to file, or even running other Script loops. In most cases, the time between cycles is adequate for this housekeeping and the Script will appear transparent; not effecting the operation of other functions being performed by ModCom. However, if a Script has an extremely long cycle time between the Loop and End Loop functions, it may slow down the update rate of the Screen Objects. If this becomes evident, placing one or more Pause functions in the body of the Script loop will give ModCom multiple opportunities to break away and perform other tasks instead of having to wait until the very end of each cycle.

 

 

ModCom HMI/SCADA Software Certificate
 

Click for the BBB Business Review of this Computer Software Publishers & Developers in Fort Walton Beach FL