Nimble Nudge (Script)

 From:  Michael Gibson
11010.7 In reply to 11010.6 
Hi Cody, so no what i wrote before about setting a command specific shortcut key doesn't sound like what you need. The command specific shortcut key thing allows a command, while it is running to intercept shortcut keys for it's own use inside the command.

If you want to add shortcut keys just like a user would do under Options > Shortcut keys, that is possible in MoI version 4 by calling moi.shortcutKeys.addShortcut( Key, Command );

You can see this being used (in v4) by ShortcutKeysOptions.htm in the \ui sub-folder. That's the UI for the Shortcut keys section of the Options dialog.

There are 4 functions in the script interface that deal with shortcut keys:

moi.shortcutKeys.removeShortcut( Key );

moi.shortcutKeys.addShortcut( NewKey, Command );

// Get a list of shortcut keys, each entry in the list has .key and .command properties.
moi.shortcutKeys.getShortcuts();

// Used by the ShortcutKeyDialog to get the string representation of the current pressed key combination.
moi.shortcutKeys.shortcutKeyCodeToString( KeyEvent );


That's all available starting with version 4 though, the shortcut key UI was rewritten for v4 where there is a dialog displayed that captures your keystroke so when you make a shortcut key you press the actual key combo to set it up rather than typing in a text label for the key.

Version 3 does not have any methods in it for a script to add shortcut keys.

- Michael