Assigns a hot key to a script or command.
If the hot key combination is already assigned to another command, it will be reassigned to this new one.
Windows does not provide a way to individually remove hot keys for an application (it only provides a way to replace the list of hot keys). Therefore, Shogun Post keeps an internal list of all hot keys, until the
-final flag is specified, when it copies the internal list to the application's list. This is done to speed up execution of the command.
The second argument (key) requires some special handling:
- For letters, use the letter itself (e.g. "s" for the S key).
- For numbers and other single character keys (e.g. =), use the character itself, but be sure to enclose it in quotes (e.g. "=").
Here is a table of all other special keys, and the string that is expected for the second argument:
|string||yes||Name of a native command or script which will execute when the Hot Key is pressed. If a script, the script must exist in the scripts directories specified in the Preferences.|
|string||yes||Key on the keyboard specifying the hot key. See Description above for valid values.|
|Name||Flag arguments||Argument type||Exclusive to||Comments|
|0||—||—||Specifies that the CTRL key must also be depressed for the command to execute. The default is no modifier.|
|0||—||—||Specifies that the Shift key must also be pressed for the command to execute. The default is no modifier.|
|0||—||—||Certain keys are repeated on the number pad portion of keyboards (e.g. 19, +, , etc). Specifies that the key is the one on the number pad.|
|0||—||—||Specifies that this call to setHotKey is the last in a series. This flag should always be provided if only one call to setHotKey is being made. This is to reduce allocation and reallocation of hot keys in the system.|
// Set some hot keys. Be sure to specify the -final
// flag on the last one.
setHotKey "cutKeys" "x" -ctrl;
setHotKey "fillGaps" "f" -shift;
setHotKey "step" "RIGHT";
setHotKey "play" "TAB";
setHotKey "stop" "TAB" -ctrl;