Macro exampleA Macro is a script assigned to a specific key on your keyboard. When you press the key, the script assigned to that key is executed.

For example:

#KEY KEY8 {cd ..}

assigns a script to the 8 key on the numeric keypad. When this NUM8 key is pressed, the script assigned to the key is executed. In this case, "cd .." is sent to the server.

As shown above, you can define macros on the command line using the #KEY command. You can also define a macro by pressing the Control-K key on the keyboard, then pressing the key you wish to assign a macro to. This will open the Package Editor and display the Editing Macros screen. You can also open the Package Editor, create a new Macro, and then press enter with the cursor in the key box to define a new macro.

To assign a macro to a key when the Control key is also pressed, precede the key name with CTRL- such as CTRL-A. Using the Alt key, precede the key name with ALT- such as ALT-A. For example:

#KEY CTRL-ALT-F1 {test}

would assign a macro to the F1 key when the Control and ALT keys are also pressed.

To assign a macro to a key combination normally reserved for a menu or Windows shortcut, be sure to go into your Preferences and turn on the "Override menu shortcut" option. You can also actually assign macros to normal text characters by enabling the "allow any key" option, but this isn't normally recommended since it will prevent you from using that letter in normal typing.

Add comment

Login or register to post comments