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

Edge HMI

RunGlobalProcedureAsync

  • Last UpdatedOct 29, 2026
  • 2 minute read

This function executes a global procedure asynchronously, in its own thread, so that it does not slow down or interfere with other running scripts. The procedure is run on the project server, but it can be called by any local or remote client.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

RunGlobalProcedureAsync

Module Activity

Asynchronous

No

Supported

Supported

Not supported

Not supported (see Notes below)

Not supported

Syntax

RunGlobalProcedureAsync( strProcedureName ) RunGlobalProcedureAsync( strProcedureName, optStrArgument1, …, optStrArgumentN )

strProcedureName

The name of the procedure (a VBScript function or subroutine defined in the VBScript Global Procedures) to run asynchronously.

optStrArgument1, …, optStrArgumentN

Values that are passed to the procedure's parameters. Arguments must be passed as strings.

Return value

If the procedure is successfully executed, then this function will return a thread ID that can be used with the RunGlobalProcedureAsyncGetStatus function. Otherwise, this function will return an error code:

Value

Description

-1

Function is not supported by thin clients.

-2

Invalid number of parameters. You must specify at least the procedure name.

-3

Maximum number of threads exceeded. See note.

-4

Failed to compile VBScript parameters for execution.

-5

Failed to start the thread execution.

-100

Internal error. Please contact technical support.

Notes

It is important to note this function can be called only in background tasks (such as Math, Scheduler, and VBScript Script) by the project runtime server. It cannot be directly called by any project viewer or thin client, even if it is on the same computer or device as the server, because the project viewer runs in its own thread separate from the project runtime server. To indirectly call this function, configure a Math or VBScript scripts (script groups) worksheet to execute on a tag/expression trigger, and then configure a project screen to activate the trigger when needed. For example, configure the worksheet to execute when the value of MyTag is 1, and then configure a Button object in a project screen to toggle the value of MyTag.

Also, the maximum number of VBScript threads that can be executed asynchronously is configured by manually editing the project file (<project name>.APP) to change the following setting:

[Script]

MaxAsyncThreads=8

The default number of threads is 8, but the only real limit is determined by the available system resources. Increasing the number of threads may decrease runtime performance.

Examples

Given the following procedure that is defined in the Procedures folder…

Function AddMe(intNumber)

If intNumber >= 6 Then

AddMe = 0

Else

AddMe = intNumber + 2

End If

End Function

…the procedure is run by calling the RunGlobalProcedureAsync function…

RunGlobalProcedureAsync( "AddMe", "2" )

…and the function returns a thread ID that can be used with the RunGlobalProcedureAsyncGetStatus function.

In This Topic