Programming with Reflection
SetKeyMap
method
Syntax object.SetKeyMap Controls, Key, Commands
Maps a PC keystroke or mouse chord to a Reflection command or command to be executed when the keystroke is pressed.
Controls Argument type: Enumeration
The optional modifier keys associated with the specified keystroke or mouse
chord. A keystroke consists of a primary key and one or more optional
modifier keysAlt,
Ctrl, and Shift. The various possible combinations of modifier keys are
defined by the values for this argument:
rcNormal
rcAlt
rcCtrl
rcShift
rcAltShift
rcCtrlShift
rcAltCtrl
rcAltCtrlShift
Use rcNormal when there are no modifier keys in this keystroke.
Key Argument type: String
The primary key or mouse chord you are mapping. Any key on the PC keyboard
can be a primary key; custom key names can be created with SetScanCodeName.
See Keys for Reflection Commands for a list of key names you can use as key arguments.
To map a mouse chord, identify the button with "LeftBtn", "MiddleBtn", or "RightBtn"; to identify a double-click of a particular button, add an underscore and "DblClk" at the end of the string. For example, "LeftBtn_DblClk".
Commands Argument type: String
The Reflection method, or sequence of methods, to be executed when the
new key is pressed. This string can be up to 260 characters long. Methods
that return values can't be used. Use a space to separate multiple methods.
Use double quotation marks around string arguments. For example, the following
strings are all valid for this argument:
"Connect"
"TransmitAnsi ""Hello"" TransmitTerminalKey rcIBMEnterKey"
"RunMacro ""MyMacro"", """""
If you're mapping a mouse chord, you can also use "Hotspot" or "DragQuickText" for this argument. Use "Hotspot" to define the mouse chord that triggers a hotspot; use "DragQuickText" to define the mouse chord that drags quick text.