AppPostMessage

AppPostMessage is a built-in scripting function that sends a Windows system message to another application window.

Function Group Execution Windows Embedded Thin Client
AppPostMessage Module Activity Synchronous Supported Supported Supported

Syntax

AppPostMessage(strAppTitle,strMessage,numWParam,numLParam { | ,optNumTimeout } )
strAppTitle
The full title (as shown in the title bar) of the application window.
strMessage
The name or code of the system message.
Note: The CLOSE, MINIMIZE, MAXIMIZE and RESTORE messages can be given as string values enclosed in quotes. All other message codes must be given as numeric values.
numWParam
Additional message-specific information.
numLParam
Additional message-specific information.
optNumTimeout
The timeout period (in milliseconds) for the function to be successfully executed. If, for whatever reason, the function is not executed in this period, then it is aborted.

This is an optional parameter. If no value is specified, then the default timeout is five seconds (or 5000 milliseconds).

Returned value

This function will return one of the following values:
Value Description
0 ERROR: The system message was not sent, or the specified application window did not respond, within the timeout period.
1 SUCCESS: The system message was successfully sent.

Notes

AppPostMessage is similar to the function PostMessage in the Microsoft Windows API, and it allows many of the same options. For more information, including a list of available system messages, please refer to the Windows API documentation.

Examples

Close the Calculator application:
AppPostMessage( "Calculator", "CLOSE", 3, 1 )