<< Click to Display Table of Contents >> Manual > Server Creation Guide > Action Edition > Action Reference > Script Ver2 (SC2) |
How to read the manual
This chapter is for reference information only.
For construction procedures, please refer to "Running your own logic in the background (SC2)" in the Monitoring System Construction Guide.
Features of this action
The Script Ver2 action allows you to execute scripts using "SC2 syntax".
In SC2 syntax, you can write advanced scripts such as if statements (conditional branching), for statements (repetitive processing), and original function definitions. In addition, it is equipped with a variety of event functions such as the OnTagValueChange event that receives tag value changes and OnExpressionValueChanged that receives the satisfaction of the condition of a pre-registered formula.
The script for Script Ver. 2 Action is written in a text file. This text file is called a "script file", and the path to the script file must be specified on the Script Ver. 2 Action setting screen. To execute this action, the script is called from an event of FA-Server such as Periodic event at the interval or timing at which the script is to be executed.
For information on the syntax available in Script Ver2, please refer to Script Ver2 (SC2 syntax). |
It is possible to register multiple Script Ver. 2 actions. Each action runs in parallel in a separate thread, so the logic of the script file for each Script Ver. 2 action can be executed in parallel. |
The script file specified in the Script Ver. 2 action can be encrypted. For details, see "Encrypting script files (Script Ver. 2)". |
Action Settings
The settings for this action are explained below.
Action specifications |
|
---|---|
Parameters |
none.
|
dialog |
■ Script In the Script tab, specify the path to the script file to be executed by this action. To execute the process you want using a script, create a script file (text file) using Notepad or similar software and write the code in that file.
■ About the script file name
If you do not want to encrypt the script, specify a plain text file with the extension ".txt" (for example, script.txt). When specifying an encrypted script file, specify the extension ".enc" (for example, script.enc).
Here, you can also specify ".*" as the script file extension (e.g. script.*). In this case, ".txt" or ".enc" will be read. If both files exist, ".txt" will take priority. The name of the script file that was actually read is output to the output log of FA-Server.
For details on encrypting script files, please refer to "Encrypting script files (Script Ver. 2)". For details on output logs, please refer to "Output log storage settings".
|
In the "Advanced Settings" tab, you can specify the timing for executing a script (SC1) before an action is executed, or the timing for adjusting the execution of the action (setting the execution wait time). For details on the advanced settings of each action, see "Settings on the Advanced Settings tab of an action". |