Core Help Root: Commands: @add-shortcut


PROGRAMMER COMMAND

Syntax: @add-s?hortcut|@as "<shortcut>" [to] "<command>" [on] <objref>

This command adds a shortcut to a <command> on <object>. This is similar to the @add-command command, however, @add-shortcut allows you to add a shortcut to an existing command, with a different name or syntax. The scope of shortcuts is global, depending upon where it is added. A shortcut added to a command-ui object which others also use will be inherited by the other users (this is the primary difference between command shortcuts and command aliases).

The shortcut may include wildcards for where arguments are accepted (where it will match anything). These wildcards are defined using an ordered mechanism of a percent-sign and a number. An example would be the following shortcut, which defines two ordered wildcards of %1 and %2:

"page %1 with %2"

The command side of the definition must also include equivalent ordered wildcards, matching the same cards defined on the shortcut (but not necessarily in the same order). You can leave out wildcards on the command side. Wildcards on the shortcut side must be defined in order, starting from one.

A full example would be the shortcut of a dash (-) for paging:

@as "-%1 %2" to "@page %1 with %2" on $user.page_cmd

See also: @del-shortcut, @add-command-alias, @del-command-alias



the Cold Dark