Description: This function returns true if the specified keyboard keys have been pressed in the sequence given.
Returns: Boolean
Usage: Steady State
Format: MatchKeys(Enable, Keys)
Parameters: Enable { Boolean } { required } { no default }
Any numeric expression that enables the function. Testing of keyboard input is enabled when this parameter is true (i.e. not 0); if it is 0 (false), the function's value is 0 (false). In addition, the Enable controls the type of comparison done. If the Enable is an odd number, the characters must match exactly; if the Enable is an even number, the comparison considers upper and lower case letters to be the same. Enable should be set to 1 if comparing extended keys.
Keys { text } { required } { no default }
A text expression giving the key sequence to test for. The case of individual letters may be significant, depending on the Enable parameter.
Comments: The Enable is a status expression controlling the comparison. The comparison starts once 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 once the Enable becomes true. This feature is useful for resetting the MatchKeys function once an action using the function's result has been performed.
The MatchKeys function is also reset automatically when it occurs in an action trigger that becomes true.
The function's result is automatically set to 0 (false) when the state containing the function is entered. Once 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 MatchKeys function is case sensitive (upper and lower case letters are treated as different characters) when the Enable is an odd number. Of ten 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 MatchKeys functions may be active at any time, each comparing the keyboard input against their own Keys parameter.
Example:
If MatchKeys(2,"SUPER");
[
...
]
When the word "super" is typed on the keyboard, regardless of case, the action will trigger, execute its script, and reset the MatchKeys function to wait until "super" is typed again.
See Also: