Script Literal
A script literal consists of a freely selectable string that is put in single (') or double (") quotation marks.
For example:
"Automation Engine"
A script literal can also contain script variables which are replaced by their values when the script line containing the script literal is processed.
For example:
:SET &TIME# = SYS_TIME("HH:MM:SS")
:PRINT "Time &TIME#"
Output:
Time 10:30:05
The AE name is a particularity of the script literal. It does not have to be enclosed in single or double quotation marks. AE names are:
- Object names,
- Attribute of objects or
- short forms of object types
For example:
:SET &STATUS# = SYS_HOST_ALIVE(WIN01)
Quotation marks are always required when the AE name starts with a number.
Note that using the string <![[ ]]> in script literals results in a syntax error and the object cannot be stored. There are several solution strategies to avoid this error:
- Insert a comment which includes these characters.
Example:
!<![[ ]]>
:PRINT '<![[ ]]>' - This error only occurs if the described characters are used one after the other. Hence, you can also compose a string of 2 different script literals.
Example: Use script variables
:SET &VAR# = "]]"
:PRINT'<![[ &VAR#>'
Example: Use the script element STR_CAT
:SET &VAR# = STR_CAT("<![[ ]]",">")
:PRINT &VAR#
Another peculiarity is the reserved combination ##<number>. If you use this string in a script literal, the text is included in the message whose number is specified in <number>. Keep this in mind when you use script literals.
For example:
:PRINT "##1800"
or
:PRINT ##1800
shows the following result in the result:
2011-06-15 13:01:51 - U0020408 ENDED_NOT_OK - aborted.|