VBScript Graphics Script
- Last UpdatedOct 29, 2026
- 3 minute read
The Graphics Script interface can be edited by its icon from the Graphics tab of the Project Explorer:

This interface can be used to execute logics on the following events, based on predefined subroutines:
-
Graphics_OnStart() : The code configured within this subroutine is automatically executed once when the graphic module is started. This interface is useful for initializing variables or executing logics that must be implemented when running the project.
-
Graphics_WhileRunning() : The code configured within this subroutine is continuously executed while the graphic module is running. The frequency at which this subroutine is called depends on the performance of the computer or device on which the project is running.
-
Graphics_OnEnd() : The code configured within this subroutine is automatically executed once when the graphic module is stopped.
-
Graphics_OnScreenResize( width, height ) : The code configured within this subroutine is automatically executed once when the display resolution changes. The new width and height of the display (in pixels) are passed to the subroutine as parameters. This subroutine is intended for projects running on devices that can switch between Portrait and Landscape display modes.
Do not change the names of the predefined subroutines. If you do, the system will not be able to automatically execute them.
Example:
'Variables with local scope can be declared and initialized here
Dim MyDate
MyDate = Date()
Dim MyValue
MyValue = 100
'Procedures with local scope can be implemented here
Function MyNewProcedure(nCount)
MyNewProcedure = nCount + 1
End Function
Function AreaRec(side1, side2)
AreaRec = side1 * side2
End Function
Sub CheckHiLimit(myValue, myHiLimit)
If myValue > myHiLimit Then
MsgBox("Value out of range")
End If
End Sub
'This procedure is executed just once when the graphic module is started
Sub Graphics_OnStart()
MsgBox("Welcome to the system!")
End Sub
'This procedure is executed continuously while the graphic module is running
Sub Graphics_WhileRunning()
If $UserName = "Guest" Then
$MyFlag = 0
End If
End Sub
'This procedure is executed just once when the graphic module is closed
Sub Graphics_OnEnd()
$LogOff()
End Sub
When the subroutines Are Executed
On the Server:
-
The graphic module is the Viewer task in the project runtime software.
-
The Graphics_OnStart() subroutine is executed once when the Viewer task is started.
-
The Graphics_WhileRunning() subroutine is continuously executed while the Viewer task is running.
-
The Graphics_OnEnd() subroutine is executed once when the Viewer task is stopped.
On the Client:
-
The graphic module is the ISSymbol control in the thin client software.
-
The Graphics_OnStart() subroutine is executed once when the user logs on to the project and a project screen is opened.
-
The Graphics_WhileRunning() subroutine is continuously executed while the user is logged on to the project (or while ISSymbol is active).
-
The Graphics_OnEnd() subroutine is executed once when the user logs off from the project and all project screens are closed (or when ISSymbol is no longer active).
Execution on each station (Server or Client) is independent from execution on every other station.
Calling Graphics Script Procedures in Other VBScript Interfaces
The three predefined subroutines are strictly local to the Graphics Script interface and are executed only on the events described above. Other variables and procedures declared in the Graphics Script, however โ under the headings 'Variables with local scope and 'Procedures with local scope โ can be called in any other Screen Script or Command animation using the syntax Graphics.variable_name or Graphics.procedure_name, respectively.
This feature is not supported on Mobile Access.
Taking the function MyNewProcedure that was declared in the example above, you could place a Button object on your project screen and then apply a Command animation to it with the following line:
$NewTag = Graphics.MyNewProcedure($OldTag)