getKey ?-p str? ?-a? ?-b? ?-c? ?-d? ?-k? ?-m?
Capture a key combo. The command prompts the user to enter a key combo, i-e to press a key on the keyboard, with or without modifier keys. The command returns the keydown event in various forms depending on the chosen options.
This command returns a list which may contain the modifiers, the character code and the key code (in that order). You specify which elements you want using any of the following options:
If none of these options is specified, -c is assumed.
You may additionally specify a format with the following options:
The -p option specifies a prompt string to display in the status bar. If it is not specified, the command displays a default string asking to enter a key combo.
The
-b option returns the key combo in a format suitable for use with the [binding] command. By default, it assumes the -c option, but specifying the -k option is possible in order to get a virtual key binding.
Here are some examples of the output of the command in the case of a ⌘A combo (note that the ascii code of 'a' is 97 and that the corresponding key on the keyboard has code 12):
CommandResult
getKeya
getKey -mc
getKey -m -cc a
getKey -m -c -d16 a
getKey -m -c -a -d16 97
getKey -m -c -kc a 12
getKey -bc 'a'
getKey -b -kcv 12