12.4ACTION commands

ACTION commands are specific to WebAccess and address the needs of scripts to interact with real time data and user.   ACTION commands are similar to pushbutton keymacros.  For example, Alarm Acknowledge, GO TO a Graphic Display, Set a Value. 

 

ACTION commands enhance the standard Tcl, VB and JAVA script commands. ACTION commands are CAPITALIZED.  The built-in Tcl, VBScript and JScript commands are usually lower case.

 

The options to ACTION commands are strings (i.e. text). The major difference in using Action commands in Tcl, JScript and VB script are the differences in how strings are handled by the three script languages.

 

 

 

The most common usage is to pass a literal string to an Action Command directly.

 

Tcl scripts uses delimiters only if there are blank spaces in the option.

ACTION option

#TCL

GOTODAQ GRAPH=main.bgr

SETVAL {rotatefan102=%LOOPPLUS 36}

 

 

JScript encloses options in parenthesis, double quotes and terminates with semicolon. ACTION("option");

// JScript

GOTODAQ("GRAPH=main.bgr");

SETVAL("rotatefan102=%LOOPPLUS 36");

 

 

VB Script encloses options in double quotes.

ACTION "option"

Rem VB Script

GOTODAQ "GRAPH=main.bgr"

SETVAL "rotatefan102=%LOOPPLUS 36"

 

From a programming perspective, the ACTION commands will also evaluate a script variable to get the string needed for an option:

 

Tcl: ACTION $variable

#TCL

set string1 "GRAPH=main.bgr"

GOTODAQ $string1

 

JScript: ACTION(variable);

// JScript

var string1 = "GRAPH=main.bgr";

GOTODAQ(string1);

 

VB Script: ACTION variable

Rem VB Script

Dim string1

string1 = "GRAPH=main.bgr"

GOTODAQ string1

 

Regarding tags, ACTION commands will also evaluate a tag to get the string needed for an option using the @ sign.

 

Tcl: ACTION @tagname

#TCL - records contents of TEXTAG1 to Action Log

LOGACT  @TEXTTAG1

 

 

JScript: ACTION("@tagname");

// JScript - records contents of TEXTAG1 to Action Log

LOGACT("@TEXTTAG1");

 

 

VB Script: ACTION "@tagname"

Rem VB Script - records contents of TEXTAG1 to Action Log

LOGACT "@TEXTAG1"

 

Note about math (use GETVAL not @):

 

Math is part of the script language itself.  ACTION commands do not have imbedded math. If you are using math, then you will have to use GETVAL instead of @, because @ can't be interpreted by Tcl, JScript or VB Script engines.   For example to set a tag to 1/2 the value of another:

# tcl

SETVAL AO101=[expr [GETVAL AO102] * 0.5]

 

// JScript

var value1

value1 = GETVAL("AO102") * 0.5;

SETVAL("AO101=" + value1);

 

Rem VB Script

Dim value1

value1 = GETVAL("AO102") * 0.5

SETVAL "AO101=" & value1