Basic syntax rules and script triggers are essential elements in programming and scripting languages.
Syntax rules refer to the structure and format of a language’s statements and commands. In programming, adhering to syntax rules is crucial because even a small error can cause the code to fail. Syntax rules dictate the correct usage of keywords, punctuation, and other elements necessary to construct a valid code statement.
Script triggers, on the other hand, are events that trigger the execution of a script or code. Script triggers can be based on various actions, such as when a user clicks a button or when data is added to a specific field. Script triggers allow developers to create dynamic and responsive applications that react to user actions and data changes in real-time.
Basic syntax rules Wonderware Intouch
Wonderware Intouch YouTube Tutorial
Basic syntax rules deal with these components of the InTouch HMI script language:
• Subroutines
• Statements
• Indentation
• Comments
• Tag references
• Literal data values
• Value expressions
• Syntax validation
There is absolutely no idea of individual subroutines inside the identical script, like “Sub” procedures in Visual Basic. To design a script into many subroutines, you’ve to create a custom
QuickFunction for every subroutine.
• a press release usually is a price assignment, a phone call, or perhaps a management structure.
• Each statement in an extreme script should conclude with a semicolon (;).
• you are going to have the capacity to have numerous statements inside a similar line, so very long as each statement finishes with a semicolon.
• you are going to have the capacity to distribute an announcement across a variety of collections by utilizing line breaks (pressing Enter).
- NB Designer OMRON HMI Youtube Tutorial Videos
- DOPSOFT DELTA HMI Youtube Tutorial Videos
- Wonderware Intouch Youtube Tutorial Videos
- GT Designer MITSUBISHI HMI Youtube Tutorial Videos
- WinCC Siemens HMI Youtube Tutorial Videos
- FACTORY TALK VIEW Youtube Tutorial Videos
Indentation You’re competent to indent your script code in any fashion. Indents do not have any practical relevance.
Comments To be able to mark text as a comment, enclose it in brackets. Comments are in a position to span several lines.
You are going to find a couple of ways to create tag references.
• In order to take a seat with a tag that is determined within the regional Tagname Dictionary, simply use the tagname.
• To watch a selected dot field, do the standard reference format (Tagname.Dotfield).
• To speak with a knowledge thing on another node, make use of a regular remote tag reference (AccessName: Item).
• you are going to have the capacity to in addition determine neighborhood variables whose scope is restricted to the current script.
• you are going to have the capacity to establish integer values in hexadecimal notation. or perhaps decimal for instance, 255 or perhaps 0xFF.
• you are going to have the capacity to establish floating point values in logical notation. or perhaps decimal as an example, 0.001 or perhaps 1E three.
• To be able to establish a Boolean value, do the numerical values zero for FALSE and one for TRUE.
• To be able to create a string value, enclose it in double quotation marks. For example: “This might be a string.”
Value expressions are in a position to consist of literal values, tag references as well as perform calls, all linked together by suitable operators.
Syntax Validation While you save a script, the Script Editor automatically checks it for right syntax. you’ll additionally launch the validation manually by clicking the Validate button. See Validating Calling Standard Functions Standard functions come predefined together with the InTouch HMI.
Script Triggers Wonderware InTouch
Every InTouch HMI script is actually carried out by software triggers. Every software style has 1 or maybe additional triggers to utilize it.
Within the Script Editor, you will choose what software trigger you wish to utilize to perform your script. you get a software trigger depending on when as well as how a program is actually performed. You are able to configure a variety of triggers supported pc user actions,
inner states, and also modifications of tagname values. Pc user steps include things like pressing keys as well as clicking on graphic components.
Inner condition triggers are able to have to start WindowViewer.
Types of Script Triggers Wonderware Intouch
In the InTouch HMI, scripts are divided into seven types. Each sort of script has one or more triggers you’ll be able to select to launch a script.
• Three triggers in an application script on startup, on shutdown, and while running. Each trigger can execute a different script.
• Three triggers are in a window script: on show, on hide, and while showing. Each trigger can execute a distinct
script.
• A key script has three triggers: on key up, on key down, or while down. Each trigger can execute a special script.
• Four triggers in a condition s: on true, while true, on false, and while false. Each trigger can execute a
different script.
• a knowledge change script executes when the worth of a certain tag or expression changes.
• An action script executes just one occasion or periodically when an operator clicks on an InTouch HMI graphic object.
• An ActiveX event script executes just once when a certain ActiveX event occurs, like a click on the
ActiveX control.
Using Multiple Triggers Wonderware Intouch
For many software variations, you will have the ability to make use of numerous triggers as well as connect various scripts with every trigger.
For instance, you will configure the software to perform a single program when WindowViewer is actually going, so a different program regularly while WindowViewer is actually working. Choose the trigger in the Condition Type checklist to read the current software for a trigger.
Script Functions wonderwaee intouch
This Appendix explains InTouch Script Functions, and is arranged to mirror the Function groupings found within InTouch.
- String Functions
- Math Functions
- System Functions
- Add-ons
- Misc Functions
Script Functions wonderwaee intouch
String Functions | |
String functions are used on string variables. | |
Function | Description |
DText | Changes a message tagname based on the value of a discrete tagname. |
StringASCII | Returns the ASCII value of the first character in a specified message tagname. |
StringChar | Returns the character corresponding to a specified ASCII code. |
StringCompare | Compares two text strings (case sensitive). |
StringCompareNoCase | Compares two text strings (case insensitive) |
StringFromIntg | Converts an integer value into its string representation in another base. |
StringFromReal | Converts a real value into its string representation, either as a floating-point |
number or in exponential notation. | |
StringFromTime | Converts a time value (in seconds since Jan-01-1970) into a particular string |
representation. The time value should be UTC equivalent (number of seconds | |
since Jan-01-1970 GMT). The value returned reflects the local time. | |
StringFromTimeLocal | Converts a time value (in seconds since Jan-01-1970) into a particular string |
representation. The value returned reflects Localtime. | |
StringInString | Returns the position in Text where Search For first occurs. |
StringLeft | Returns the number of characters specified by Chars starting with the leftmost |
character of text. | |
StringLen | Returns the length of text to integer result. |
StringLower | Converts all the uppercase characters in text to lower case and places the |
resulting string in MessageResult. | |
StringMid | Extracts from text the specific numbers of characters specified by Chars, starting |
at the position StartChar. This function is slightly different from its counterparts, | |
StringLeft() function and StringRight() function, in that it allows the user to | |
specify both the start and end of the string to be extracted from the message tag. | |
StringReplace | Replaces or changes specific parts of a provided string. Using this function can |
take a string tagname and replace characters, words or phrases. | |
StringRight | Returns the number of character specified by Chars starting at the rightmost |
character of text. | |
StringSpace | Generates a string of spaces within a message tagname or an expression. |
StringTest | Tests the first character of text to determine whether it is of a certain type. |
StringToIntg | Converts the numeric value of a message tagname to an integer value to which |
mathematical calculations can be applied. | |
StringToReal | Converts the numeric value of a message tagname to a real (floating point) |
value to which mathematical calculations can be applied. | |
StringTrim | Removes unwanted spaces from text. |
StringUpper | Converts all the lowercase character in text to uppercase. |
Text | Causes a message type tagname to display the value of an analog (integer or |
real) tagname based on the specified Format_Text. | |
WWStringFromTime | Extracts 1 of 5 time formats from a given time/date formatted field: |
1: 08/22/2003 | |
2: 12:51:26 AM | |
3: Fri Aug 22 00:52:03 2003 | |
4: Fri | |
5: Friday | |
Math Functions | |
The following table briefly describes each math script function. For more details and syntax examples, please refer to the InTouch application Help files. | |
Function | Description |
Abs | Returns the absolute value (unsigned equivalent) of a specified number. |
ArcCos | Given a number between -1 and 1 (inclusive), returns an angle between 0 and |
180 degrees whose cosine is equal to that number. | |
ArcSin | Given a number between -1 and 1 (inclusive), returns an angle between -90 and |
90 degrees whose sine is equal to that number. | |
ArcTan | Given a number, returns an angle between -90 and 90 degrees whose tangent is |
equal to that number. | |
Cos | Returns the cosine of an angle given in degrees. |
Exp | Returns the result of e raised to a power. |
Int | Returns the next integer less than or equal to a specified number. |
Log | Returns the natural log of a number. |
LogN | Returns the values of the logarithm of x to base n. |
Pi | Returns the value of Pi. |
Round | Rounds a real number to a specified precision. |
Sgn | Determines the sign of a value (whether it is positive, zero, or negative). |
Sin | Returns the sine of an angle given in degrees. |
Sqrt | Causes InTouch to automatically calculate the square root of the value, which |
follows the statement. | |
Tan | Returns the tangent of an angle given in degrees. |
Trunc | Truncates a real (floating point) number by eliminating the portion to the right of |
the decimal point. | |
System Functions | |
The following table briefly describes each system script function. For more details and syntax examples, please refer to the InTouch application Help files. | |
Function | Description |
ActivateApp | Activates another currently running Windows application. |
FileCopy | Copies a SourceFile to a DestFile, similar to the DOS Copy command or the |
Copy function in Windows File. | |
FileDelete | Deletes unnecessary or unwanted files. |
FileMove | Similar to FileCopy() except that it moves the file from one location to another. |
FileReadFields | Reads a Comma Separated Variable (CSV) record from a specified file. |
FileReadMessage | Reads specified number of bytes (or a whole line) from a specified file. |
FileWriteFields | Writes a Comma Separated Variable (CSV) record to a specified file. |
FileWriteMessage | Writes a specified number of bytes (or a whole line) to a specified file. |
InfoAppActive | Tests whether an application is active. |
InfoAppTitle | Returns the Application Title or Windows Task list name of a specified program |
which is currently running. | |
InfoDisk | Returns information about a specific local (or network) disk drive. |
InfoDosEnv | This function is used to retrieve the setting of a particular DOS environment |
variable. | |
InfoFile | Returns information about a specific file or subdirectory. |
InfoInTouchAppDir | Returns the current InTouch application directory. |
InfoResources | Returns various system resource values. |
StartApp | Automatically starts another Windows application. |
Add-ons | |
Add-on functions are outside the scope of the InTouch Basic course. They are included here for completeness. | |
For more information about Add-ons functions, please refer to the InTouch help files. | |
Function | Description |
RecipeDelete | Deletes a Recipe Name from the specified recipe template file. |
RecipeGetMessage | Writes an error code to an Analog tagname and the corresponding |
error code message to a Message tagname. | |
RecipeLoad | Loads a specific recipe to a specific unit of tagnames. |
RecipeSave | Saves a newly created recipe or to save changes made to an existing |
recipe to the specified recipe template file. | |
RecipeSelectNextRecipe | Selects the next Recipe Name currently defined in the recipe template |
file. | |
RecipeSelectPreviousRecipe | Selects the previous Recipe Name currently defined in the recipe |
template file. | |
RecipeSelectRecipe | Selects a specific Recipe Name currently defined in the recipe template |
file. | |
RecipeSelectUnit | Selects the unit of tagnames to which the current recipe values will be |
loaded. | |
SPCConnect | Used in conjunction with automatic data collection datasets. Before an |
Automatic data collection dataset will start collecting data, this function | |
must be used to indicate to SPC which user the node is. | |
SPCDatasetDig | This function is used to display the SPCPro Dataset Configuration |
dialog box in WindowViewer. New Datasets can be added and deleted. | |
There are no parameters or any return value. | |
SPCDiconnect | This function is used to disconnect an Agent from a SPC Pro database. |
When this function is used, all datasets that were assigned to the Agent | |
that was disconnected will stop collecting. | |
SPCDisplayData | This function is designed to allow convenient scrolling of the chart to |
any date and time. You can use a tagname to monitor the status of the | |
SPC data search. Status will contain a 0 if SPC found data and 1 if it | |
could not find data for the specified time period. | |
SPCLocateScooter | This function is designed to allow convenient scrolling of the Scooter to |
any valid sample number. The Scooter tagname defined in the dataset | |
will be updated with the X-Bar sample value. Setting SampleNumber to | |
0 hides/disables the Scooter. | |
SPCMoveScooter | This function is designed to allow convenient scrolling of the Scooter to |
any valid sample number. The Scooter tagname defined in the dataset | |
will be updated with the X-Bar sample value. | |
SPCSaveSample | Saves a manually input sample. This function is used in conjunction |
with the SPCSetMeasurement function. | |
SPCSelectDataset | Opens a dialog box from which the user may select a direct dataset. |
SPCSelectProduct | Opens a dialog box from which the user may select a product in a given |
dataset. | |
SPCSetControlLimits | Allows convenient manual or event driven input of the control limit |
values for a Control Chart. | |
SPCSetMeasurement | Allows convenient manual or event driven inputs of analog |
measurement values by processing the QuickScript. | |
SPCSetProductCollected | Changes the product being collected in a specified Dataset. |
SPCSetProductDisplayed | Changes the product being displayed in a specified Dataset. |
Function | Description |
SPCSetRangeLimits | Allows convenient manual or event driven input of the Control Limits for |
a Range Chart. | |
SPCSetSpecLimits | Allows convenient manual or event driven input of the specification limit |
values for a Control Chart. | |
SQLAppendStatement | Continues a SQL statement using the contents of string. Errors are |
returned in the function return. | |
SQLClearParam | Clears the value of the specified parameter. SQLSetParam must be |
called again before calling the SQLExecute() function. | |
SQLClearStatement | Releases the resources associated with the statement specified by |
SQLHandle. | |
SQLClearTable | Deletes all records in a database table, but keeps the table. |
SQLCommit | The SQLCommit() command defines the end of a group of transaction |
commands. The group of commands performed between the | |
SQLTransact() command and the SQLCommit() command is called a | |
transaction set. A transaction set is handled like a single transaction. | |
After the SQLTransact() command is issued, all subsequent operations | |
will not be committed to the database until the SQLCommit() command | |
is issued. | |
SQLConnect | Connects InTouch to the database specified in the ConnectString. |
SQLCreateTable | Creates a table in the database using the parameters in the named |
Table Template. Table Templates (defined in the SQL.DEF file) | |
determine the structure of a database table. | |
SQLDelete | Deletes a record or multiple records. |
SQLDisconnect | Disconnects the user from the database. |
SQLDropTable | Destroys a table. |
SQLEnd | This is used after a SQLSelect() function to free resources that were |
being used to store the Results Table. | |
SQLErrorMsg | Retrieves the text error message associated with a specific |
ResultCode. ErrorMsg is the InTouch Memory Message tagname | |
(maximum 131 characters) associated with ResultCode. | |
SQLExecute | Executes the SQL statement. If the statement is a select statement, the |
BindList parameter designates the name of the BindList to use for | |
binding the database columns with tagnames. If the BindList is NULL, | |
no tagnames relationships are formed. For example, the SQL | |
statement could be Create View, Insert, and so on. Errors are returned | |
in the function return. If the statement has been “prepared,” the | |
statement handle returned from the prepare should be passed. If the | |
statement has not been prepared, the statement handle should be zero | |
(0). | |
SQLFirst | Selects the first record of the Results Table created by the last |
SQLSelect() function. A SQLSelect() function must be processed | |
before using this command. | |
SQLGetRecord | Retrieves the record specified by RecordNumber from the current |
selection buffer. | |
SQLInsert | Inserts a new record into the referenced table using the values of the |
tagnames in the supplied BindList. The BindList parameter defines | |
which InTouch tagnames are used and which database columns they | |
are associated. | |
SQLInsertEnd | Releases the statement. |
SQLInsertExecute | Execute the already prepared statement. |
Function | Description |
SQLInsertPrepare | Creates and prepares an Insert statement for execution. The Insert |
statement is not processed. The SQLHandle parameter is an Integer | |
tagname that will contain a value after the statement is processed. | |
SQLLast | Selects the last record of the Results Table created by the last |
SQLSelect() function. A SQLSelect() function must be processed | |
before using this command. | |
SQLLoadStatement | Reads the statement contained in FileName. At this point the statement |
is similar to one created by SQLSetStatement() function, and can be | |
appended to via SQLAppendStatement() function, or executed by | |
SQLExecute() function. There can be only one statement per file. | |
However, SQLAppendStatement() function can be used to append | |
something to the statement if SQLPrepareStatement() function or | |
SQLExecute() function has not been called. | |
SQLManageDSN | Runs the Microsoft ODBC Manager setup program. This can be used |
to add, delete and modify all data source names. | |
SQLNext | Selects the next record of the Results Table created by the last |
SQLSelect() function. A SQLSelect() function must be processed | |
before using this command. | |
SQLNumRows | Indicates how many rows met the criteria specified in the last |
SQLSelect() function. For example, if a WhereExpression is used to | |
select all rows with a column name AGE, where AGE is equal to 45, the | |
number of rows returned could be 40 or 4000. This may determine | |
which function is processed next. | |
SQLPrepareStatement | A SQLPrepareStatement() prepares an existing SQL statement for use |
by the SQLSetParam() function. A statement can be created by using | |
either a SQLSetStatement(), or SQLLoadStatement(). The statement | |
handle is returned. | |
SQLPrev | Selects the previous record of the Results Table created by the last |
SQLSelect() function. | |
SQLRollback | The SQLRollback() command reverses, or “rolls back,” the most |
recently committed transaction set. A transaction set is a group of | |
commands issued between the SQLTransact() command and the | |
SQLCommit() command or the SQLRollback() command. A transaction | |
set is handled like a single transaction. After the SQLTransact() | |
command is issued, all subsequent operations are not committed to the | |
database until the SQLCommit() command is issued. | |
SQLSelect | Instructs the database to retrieve information from a table. When a |
SQLSelect() function is processed, a temporary Results Table is | |
created in memory, containing records that can be browsed using | |
SQLFirst(), SQLLast(), SQLNext() and SQLPrev() functions. | |
Note Always use the SQLEnd() function after a SQLSelect() to free | |
resources that were being used to store the Results Table. | |
SQLSetParamClear | Sets the value of the specified parameter to the specified string. |
SQLSetParamChar() function may be call multiple times before | |
executing, resulting in the parameter value being set to the | |
concatenation of all values sent. Lengths of 0 (zero) are ignored. | |
SQLSetParamDate | Sets the value of the specified date parameter to the specified string. |
SQLSetParamDateTime | Sets the value of the specified date-time parameter to the specified |
string. | |
SQLSetParamDecimal | Sets the value of the specified decimal parameter to the specified |
string. Precision is the number of digits in the value and Scale is the | |
number of digits to the right of the decimal point. | |
SQLSetParamFloat | Sets the value of the specified parameter to the specified |
ParameterValue. | |
SQLSetParamInt | Sets the value of the specified parameter to the specified |
ParameterValue. | |
SQLSetParamLong | Sets the value of the specified parameter to the specified |
ParameterValue. | |
SQLSetParamNull | Sets the value of the specified parameter to the NULL. |
SQLSetParamTime | Sets the value of the specified time parameter to the specified string. |
SQLSetStatement | Starts a SQL statement buffer using the contents of SQLStatement, on |
the established connection, ConnectionID. There can be one SQL | |
Statement buffer per ConnectionID. Errors are returned in the function | |
return. | |
SQLTransact | The SQLTransact() command defines the beginning of a group of |
transaction commands. The group of commands performed between | |
the SQLTransact() command and the SQLCommit() command is called | |
a transaction set. A transaction set is handled like a single transaction. | |
After the SQLTransact() command is issued, all subsequent operations | |
will not be committed to the database until the SQLCommit() command | |
is issued. | |
SQLUpdate | Modifies a record to update the record with the current tagname values. |
SQLUpdateCurrent | Takes the currently selected record and updates it with any new |
InTouch values. The following example will update the currently | |
selected record. |
Useful Links:-