WinMatchKeys
(Engine-Level Function)
Description: | Returns true if the specified keyboard keys have been pressed in the sequence given, in another window. |
Returns: | Boolean |
Usage: | Steady State only. |
Function Groups: | Keyboard |
Related to: | MatchKeys |
Format: | WinMatchKeys(Object, Enable, Keys) |
Parameters: |
Object |
Required. Any expression which gives the object value of any module instance which is running in the window. |
Enable |
Required. Any numeric expression giving an enable for the function. Testing of keyboard input is enabled when this parameter is true (not 0). If this parameter is false(0), the function's value is false(0). In addition, the Enable parameter controls the type of comparison done. If the Enable is 1, a case-sensitive match is made. If the Enable is 2, then the match is not case-sensitive. (Any non-zero value other than 2 will cause a case-sensitive match. The use of 1 and 2 is recommended for clarity.) |
Keys |
Required. A text expression giving the key sequence to watch for. The case of individual letters may be significant, depending on the Enable parameter. For example: PageUp = Concat(MakeBuff(1, 253), MakeBuff(1, 0x49)); F2 = Concat(MakeBuff(1,253), MakeBuff(1,60)); F3 = Concat(MakeBuff(1,253), MakeBuff(1,61)); CtrlZKey = MakeBuff(1, 26); |
Comments: | The Object is used to determine which window to watch for the keystrokes in. The Enable is a status expression controlling the comparison. The comparison starts after the Enable becomes true. If the Enable becomes false, the function's value becomes false and the comparison starts at the beginning of the Keys string again after the Enable becomes true. This feature is useful for resetting the WinMatchKeys function after an action using the function's result has been performed. The WinMatchKeys function is also reset automatically when it occurs in an action trigger that becomes true. The function's result is automatically set to false(0) when the state containing the function is entered. After the function becomes true, it remains true as long as the state does not change and the Enable remains true. Any key sequence may be used for the Keys parameters including the function keys. Note that the WinMatchKeys function is case sensitive (upper and lower case letters are treated as different characters) when the Enable is an odd number. Often only one key is included in the Keys string. Several keys may be used in the Keys string and function as a password. The keys typed are not displayed on the screen by this function. Several WinMatchKeys functions may be active at any time, each comparing the keyboard input against their own Keys parameter. |
Example:
If WinMatchKeys(secondaryWin, 2, "go"); [ ... ]
This statement will wait until the window designated by secondaryWin is active and then will further wait until the keys "go" (in any case, upper or lower) is entered at the keyboard. At that point the function will return true and the script will execute.