Close is a built-in scripting function that closes an open project screen.

Function Group Execution Windows Embedded Thin Client Mobile Access
Close Screen Asynchronous Supported Supported Supported Supported


Web Studio Help pics2ffunctions screen close.xml d414001e89 Close
The name of the screen (not including the .scr extension) to be closed.
The specific ID or instance number of the screen to be closed, if there is more than one screen with the same name open. (The ID is assigned when the screen is opened with the function Open.)

This is an optional parameter. If no value is specified, the default ID is 0.

Returned value

This function does not return any value.


If the option Enforce Web functionality equivalence is selected in the project settings, this function cannot be called from Global Procedures or Script worksheets. This is because the function is meaningful only when it is executed on stations that display project screens; it might cause unexpected behavior if it is called from background tasks that are executed on the project runtime server. For more information, see Preferences tab.

The following limitations also apply to how the function can be used in project screens in Mobile Access:
  • The function cannot be called from the sub-routine Screen_OnClose in the Screen Script; and
  • You should avoid creating a script that both shows a dialog box (e.g., a message box that is shown using the VBScript function MsgBox or the IWS built-in function ShowMessageBox) and opens or closes a screen. The Mobile Access web interface can display only one screen at a time, and opening a new screen will automatically close the previous one. Depending on the order of execution, this can lead to unexpected behavior such as a dialog box being orphaned or not being shown at all.

Finally, in some cases, you do not need to call this function to close a screen because the screen will be closed automatically when another screen replaces it. For more information, see Screen Attributes.


Close the screen named “main”:
  Close( "main" )  
Close the screen named “alarms”:
  Close( "alarms" )  
Close the screen named “main” with ID 10:
  Close( "main", 10 )