System Functions Library
Summary
System Function Libraries (SVFunctions) are functions that the ADISRA
SmartView makes available to the user that cannot be changed nor excluded, they are grouped into different libraries. All these functions can be used in any script (i.e., service document, trigger, screens, etc.).
The avaliabe Libraries are:
- SVApplications
- SVDBConnection
- SVEvent
- SVFile
- SVGraphics
- SVHistory
- SVMath
- SVRecipe
- SVReport
- SVSecurity
- SVString
- SVTags
Using SVFunctions
To access the SVFunctions available, expand the node “System Function
Libraries” on the navigation tree and open one of the documents.
Each of the documents under “System Functions Library” contains the
functions signature. The user will not be able to see the function’s
implementation, but they will learn how to use them. The function signature
shows the parameters expected for each of the functions and the function’s
return type. If further function information is needed, please expand the
regions (+) and there will be a summary for each of the functions and a
summary for each of the parameters. Additionally, the Help file can be
checked for further information and examples.
Intellisense
The Intellisense is an ADISRA SmartView feature that autocompletes the script
codes. It can be used for adding tags into different fields/scripts (when @ sign is
written into a script, it shows all the application tags available) and it can also be
used to add the System Function Libraries.
All of the System Function Libraries starts with an SV prefix, so as soon as the user
types “SV” in the script box, all of the libraries will be listed and can be selected.
After selecting the library (i.e. SVApplication), the user will have access to the
functions after typing a period (.).
Examples
Output
How to use a function to log a message in the “Engineering Log” will be
described in this example.
SVApplications.Output()
Configure the “mouse up” script in a button object as shown in the image
below:
Every time the button is pressed during runtime it will log the message in
the “Engineering Log” as shown in the image below:
It is also possible to pass a tag as parameter to the SVApplication.Output()
function and the result will be a new output log showing the value of the tag.
ShutdownWindows
How to use a function to shut down or restart Windows will be explained in
this example.
SVApplications.ShutdownWindows()
Configure the “mouse up” script in a button object as shown in the image
below:
In this case, the first parameter “true” indicates that the machine will shut
down, the second parameter “10” indicates that the shutdown will occur 10
seconds after the button is pressed, and the last parameter “true” indicates
that the shutdown will be forced.
See another example below:
In this case, the first parameter “false” indicates that the machine will
restart, the second parameter 0 indicates that the restart will occur instantly
after the button is pressed, and the last parameter “false” indicates that the
restart will not be forced.
Send
How to use a function to trigger an event will be described in this example.
SVEvent.Send()
Configure the “mouse up” script in a button object as shown in the image
below:
The example below shows all the ways to trigger an event. It is important to
understand that the first line of the script triggers the event, as seen in line 1
below with the message “Message1”, the default priority, and no group. The
second line of the script triggers event 2, with the message “Message2”, the
default priority, and “Group2”. The third line of the script triggers event 3,
with the message “Message3”, priority “3” and “Group3”.
Close
How to use a function to close a graphic will be explained in this example.
SVGraphics.Close()
Configure the “mouse up” script in a button object as shown in the image
below:
In this example, the button will close current graphic document. If the
document is a parent document with children documents opened, all graphics
will be closed.
There is an alternative to close graphics. A specific graphic can also be closed
if the script passes the graphic’s name as parameter to the
SVGraphics.Close(). The image below shows a script closing “Graphics2”
screen. If the Graphics2 document is a parent document with children
documents opened, all graphics will be closed.
Open
How to use a function to open a graphic will be explained in this example.
SVGraphics.Open()
Configure the “mouse up” script in a button object as shown in the image
below:
In this example, the button will open the graphic document “Graphics2”.
ProjectPath
How to use a function that returns a string value containing the path of the
project will be explained in this example.
SVApplications.ProjectPath()
Configure the script for the “Startup” Service document as show in the image
below:
Every time the application starts, the script in the “Startup” service will
execute once. In the example above, the tagA will be initialized with the
SVApplication.ProjectPath().
ToLower
This function modifies the string parameter to lower case.
SVString.ToLower()
Configure a trigger document as show in the image below:
Every time the tag “TagStr” changes its value it will execute the expression
configured. In this example, it will transform the value of “TagStr” to lower
case.