Configuring Keyboard Shortcuts in an XML File
Normally, the keyboard shortcuts are defined in the Keyboard Shortcuts dialog ( .) When the user makes changes to the keyboard shortcuts, the definitions are saved to the XML file specified by the configuration variable MS_KEYBOARDSHORTCUTS. If the file specified by MS_KEYBOARDSHORTCUTS does not exist, the system will try to read the default keyboard shortcuts from the file specified by MS_KEYBOARDSHORTCUTSSEED. If neither MS_KEYBOARDSHORTCUTS nor MS_KEYBOARDSHORTCUTSSEED are defined, or the files specified by them do not exist, the system defined defaults are used. If you are an administrator and want to provide custom keyboard shortcuts across your team, you may do so by configuring the keyboard shortcuts on one machine and then copying that file to your users machine and setting MS_KEYBOARDSHORTCUTSSEED to point to this file. You can also directly edit this XML file.
You can map a key stroke to a key-in or define a hierarchy of key strokes to a key-in. In the example below, the <Space (bar)> key is mapped to the key-in to pop-up the ribbon group containing AccuDraw tools. The keystroke <G> defines child keystroke that would be used to send AccuDraw specific commands. The key stroke combination of <G+A> will send the key-in ACCUDRAW DIALOG GETACS.
<KeyboardShortcuts> <KeyboardShortcut ScanCode="0x39" Comment="Space"> <Label>AccuDraw</Label> <Keyin>ribbon grouppopup *\Drawing Aids\Accudraw</Keyin> </KeyboardShortcut> <KeyboardShortcut ScanCode="0x22" Comment="G"> <Label>G Shortcuts</Label> <KeyboardShortcuts> <KeyboardShortcut ScanCode="0x1e" Comment="A"> <Label>Get ACS</Label> <Keyin>accudraw dialog getacs</Keyin> </KeyboardShortcut> <KeyboardShortcut ScanCode="0x1f" Comment="S"> <Label>AccuDraw Settings</Label> <Keyin>accudraw dialog settings</Keyin> </KeyboardShortcut> </KeyboardShortcuts> </KeyboardShortcut> … </KeyboardShortcuts>
Scan Code Key 0x10, 0x11, 0x12, 0x13, 0x14, Q W E R T 0x15, 0x16, 0x17, 0x18, 0x19, Y U I O P 0x1e, 0x1f, 0x20, 0x21, 0x22, A S D F G 0x23, 0x24, 0x25, 0x26, 0x27, H J K L ; 0x2c, 0x2d, 0x2e, 0x2f, 0x30, Z X C V B 0x31, 0x32, 0x33, 0x34, 0x35}; N M , . / 0x39 Space key
The Comment attribute is optional and is typically used to show the label of the key associated with the scan code. This value is not used during processing.
- ribbon grouppopup [RibbonGroupPath]
- ribbon popuptask [TaskPath]
- ribbon popupmaintask [MainTaskPath]
- ribbon popupcustomtoolbox [CustomToolboxPath]
The [TaskPath], [MainTaskPath], and [CustomToolboxPath] are the paths used to navigate to a task, main task, or toolbox, when looking at the tree in the Customize dialog. For example, let's say you want to call the task Build town in the Main task Town Task Example, then the key-in to pop-up the Build Town task will be ribbon popuptask Town Task Example\Build Town.