AppActivate
AppActivate is a built-in scripting function that activates (i.e., brings to the front) another application window that is already open.
Function | Group | Execution | Windows | Embedded | Thin Client | Mobile Access |
---|---|---|---|---|---|---|
AppActivate | Module Activity | Asynchronous | Supported | Supported | Supported | Not supported |
Syntax
- strAppTitle
- The full title (as shown in the title bar) of the application window.
- optNumActiv
- Controls how the specified window is to be activated:
Value Command Description 0 SW_HIDE Hides the currently active window and then activates the specified window. 1 SW_SHOWNORMAL Activates and displays the specified window. If the window is minimized or maximized, then it is restored to its original size and position. You should use this command when displaying a window for the first time.
2 SW_SHOWMINIMIZED Activates the specified window and then minimizes it. 3 SW_SHOWMAXIMIZED Activates the specified window and then maximizes it. 4 SW_SHOWNOACTIVATE Displays the specified window, but does not activate it. If the window is minimized or maximized, then it is restored to its original size and position. 5 SW_SHOW Activates and displays the specified window in its current size and position. This is similar to SW_SHOWNORMAL except that if the window is minimized or maximized, then it remains in that state. 6 SW_MINIMIZE Minimizes the specified window and then activates the next open window. 7 SW_SHOWMINNOACTIVATE Displays the specified window as a minimized window, but does not activate it. 8 SW_SHOWNA Displays the specified window in its current size and position, but does not activate it. This is similar to SW_SHOWNOACTIVATE except that if the window is minimized or maximized, then it remains in that state. 9 SW_RESTORE Activates and displays the specified window. If the window is minimized or maximized, then it is restored to its original size and position. You should use this command when restoring a minimized window.
This is an optional parameter. If no value is specified, then the default command is SW_RESTORE.
- 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 specified application window was not activated or otherwise did not respond within the timeout period. |
1 | SUCCESS: The specified application window was successfully activated. |
Notes
AppActivate is similar to the function ShowWindow in the Microsoft Windows API, and it allows many of the same options. For more information, please refer to the Windows API documentation.
Examples
Show the Microsoft Word document named test.doc:
AppActivate( "test.doc — Microsoft Word", 5 )