Intouch Script Function Sample of InfoAppStatus

Description

InfoAppStatus returns either a TRUE or FALSE value which tells the current status of the specified application. See Tech Support Script Function Library to install this function.

Use:

InfoAppStatus(WindowName, DesiredState, Errorcode, Trigger);

WindowName A message tag or a quoted string (example: “NOTEPAD – NOTES.TXT”) which is the formal name of a window that is currently open. We suggest that this parameter be the return value from the function InfoAppTitle() or InfoAppTitleExpand().
DesiredState See below for a list of valid DesiredState values. Note that the Message tag or quoted string (such as “MAXIMIZED” ) that is entered for DesiredState must be an item from this list.
Errorcode An integer tagname that InfoAppStatus() uses to report the current status of the specified function. This parameter must be the tagname itself, not a character string.
Trigger An integer tagname to be used to define when the function will be evaluated.

Returns

Because InfoAppStatus() returns either a Boolean TRUE or FALSE, it cannot tell the script if an error occurs during its evaluation. Therefore, to monitor the internal state of the function, you must specify an integer tagname for the Errorcode parameter (either Memory, DDE or Indirect). While InfoAppStatus() is evaluating, this tag will be updated with any errors that may occur.

The Errorcode tag will store the following values:

For InTouch Release 5.6 under Windows 95:

  • 0 Status is ON and the application is in focus.
  • 0 Status is OFF and the application is in the background.
  • -3 Status is OFF and the application is closed.

For InTouch Release 6.0 and later under Windows NT 4.0:

  • 0 Status is OFF and the application is in focus.
  • 0 Status is ON and the application is in the background.
  • -3 Status is OFF and the application is closed.

Details of InfoAppStatus()

InfoAppStatus() is powerful. It allows you to define the action of a script based on the current state of an application. For example, you can create a Condition script in your InTouch™ application to alert the user that a particular event has occurred. (Example: The tank is done filling, but InTouch is not currently in the foreground.) Playing a sound or executing an AppActivate() function in your InTouch application would get the user’s attention.

Here are the valid values for the DesiredState parameter.

Important DesiredState is case sensitive. Use all caps when entering the DesiredState value.

“MINIMIZED” If the application is currently minimized, InfoAppStatus() will return TRUE.
“MAXIMIZED” If the application is currently maximized, InfoAppStatus() will return TRUE.
“RESTORED” If the application is currently not an icon. InfoAppStatus() will return TRUE.
“INFOCUS” If the application is in focus (the title bar is highlighted), InfoAppStatus() will return TRUE.

Note The INFOCUS parameter will only work for View.exe, it will not work for any other executable.

The tagname which is specified as the Trigger parameter will cause InfoAppStatus() to re-evaluate whenever the tag value changes. This is useful if InfoAppStatus() is in a Condition script or a Data Change script, or the Trigger value used in a discrete color fill or visibility type link. If the value of Trigger changes, InfoAppStatus() re-evaluates and the script or link is also updated.

For example, the following InfoAppStatus() was used in a visibility link expression for the text “Solitaire is maximized!!” in an InTouch application window:

InfoAppStatus( “Solitaire”,”MAXIMIZED”, Errorcode, $Minute );

Each minute the value of $Minute would change and InfoAppStatus() would be re-evaluated. If someone maximized Solitaire, InfoAppStatus() would return True. Otherwise, if Solitaire was not maximized, InfoAppStatus() would return False. Even if the value was False, you should check the value of Errorcode because if Solitaire was not running, InfoAppStatus() would return False, but the value of Errorcode would be -3.

Example of Using InfoAppStatus()

The following is a script that uses InfoAppStatus():

{ This is an example of using the InfoAppStatus() Script function}
{ Call the function to see if the WindowViewer has been made an ICON}
ViewerIsIcon = InfoAppStatus ( InfoAppTitle( “view” ), “MINIMIZED”, Errorcode, $Minute );

Executing the script would set ViewerIsIcon to True if WindowViewer is an icon. If the WindowViewer is not an icon, ViewIsIcon would be False. If this was used as the expression of a Data Change script or another script or link, the current status of WindowViewer would be checked every one minute.

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 3 = 9