Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

VBScript screen scripts

  • Last UpdatedOct 29, 2026
  • 2 minute read

Each project screen has an associated screen script. To edit the screen script for a given project screen, open the screen worksheet for editing and then do one of the following:

  • On the Draw tab of the ribbon, in the Screen group, use Script.

  • Right-click in the screen worksheet, and then select Screen Script on the shortcut menu.

    Screen script window

This interface can be used to execute logics on the following events, based on preconfigured subroutines:

  • Screen_IsClosedByReplace(): This procedure determines whether the screen is automatically closed when another screen is opened to replace it. If the procedure is given a value of 0 or FALSE, then automatic closing is disabled. When the function is given a positive value (for example, 1) or TRUE, or if the procedure is not declared at all, then automatic closing is enabled.

  • Screen_OnOpen(): The code configured within this subroutine is automatically executed just once when the screen is opened.

  • Screen_WhileOpen(): The code configured within this subroutine is automatically executed continuously while its screen is open. The rate in which this subroutine is called depends on the performance of the platform where the project is running.

  • Screen_OnClose():The code configured within this subroutine is automatically executed just once when the screen is closed.

The variables and procedures declared in this interface are available for the VBScript interfaces of the screen where the Screen Script is configured.

Notes

  • Do not change the names of the preconfigured subroutines described above. If you do, then the system will not be able to call them.

  • The execution of the Screen Script subroutines on the server is totally independent of the execution on the Thin Client stations. In other words, these subroutines are executed asynchronously.

  • The procedures and/or variables declared in the Screen Script interface have local scope. They can be called only from the specific screen on which they are declared.

Example:

'Variables available on this screen can be declared and initialized here

Dim Counter

'Procedures available on this screen can be implemented here

Function AreaCircle(radius)

AreaCircle = Sqr(radius) * $Pi()

End Function

Sub CheckLoLimit (myValue, myLoLimit)

If myValue < myLoLimit Then

MsgBox("Value out of range")

End If

End Sub

'This procedure determines whether the screen is automatically closed

Function Screen_IsClosedByReplace()

Screen_IsClosedByReplace = $ReplaceModeTag

End Function

'This procedure is executed just once when this screen is open

Sub Screen_OnOpen()

MsgBox("The screen was open!")

End Sub

'This procedure is executed continuously while this screen is open

Sub Screen_WhileOpen()

If Counter < 100 Then

Counter = Counter + 1

Else

Counter = 0

End If

$SimulationTag = Counter

End Sub

'This procedure is executed just once when this screen is closed

Sub Screen_OnClose()

MsgBox("The screen will be closed!")

End Sub