Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

runTimeCommand [-annotation string] [-category string] [-categoryArray] [-command script] [-commandArray] [-commandLanguage string] [-default boolean] [-defaultCommandArray] [-delete] [-exists] [-hotkeyCtx string] [-numberOfCommands] [-numberOfDefaultCommands] [-numberOfUserCommands] [-save] [-showInHotkeyEditor boolean] [-userCommandArray] name

runTimeCommand is undoable, queryable, and editable.

Create a MEL command given the specified name. Once the command is created you can invoke it like any other MEL command. When the command is invoked it will execute the string attached to the command flag.

Note that the resulting command takes no arguments, has no flags and may not be queried or edited.

The command name you provide must be unique. The name itself must begin with an alphabetic character or underscore followed by alphanumeric characters or underscores.

If you create your run time commands in a script which is automatically sourced at startup then set the default flag to true. This will prevent the application from attempting to save these commands.

Return value

stringThe name of the command on.

In query mode, return type is based on queried flag.

Flags

annotation, category, categoryArray, command, commandArray, commandLanguage, default, defaultCommandArray, delete, exists, hotkeyCtx, numberOfCommands, numberOfDefaultCommands, numberOfUserCommands, save, showInHotkeyEditor, userCommandArray
Long name (short name) Argument types Properties
-annotation(-ann) string createqueryedit
Description of the command.
-category(-cat) string createqueryedit
Category for the command.
-categoryArray(-caa) query
Return all the run time command categories.
-command(-c) script createqueryedit
Command to be executed when runTimeCommand is invoked.
-commandArray(-ca) query
Returns an string array containing the names of all the run time commands.
-commandLanguage(-cl) string createqueryedit
In edit or create mode, this flag allows the caller to choose a scripting language for a command passed to the "-command" flag. If this flag is not specified, then the callback will be assumed to be in the language from which the runTimeCommand command was called. In query mode, the language for this runTimeCommand is returned. The possible values are "mel" or "python".
-default(-d) boolean createquery
Indicate that this run time command is a default command. Default run time commands will not be saved to preferences.
-defaultCommandArray(-dca) query
Returns an string array containing the names of all the default run time commands.
-delete(-del) edit
Delete the specified user run time command.
-exists(-ex) create
Returns true|false depending upon whether the specified object exists. Other flags are ignored.
-hotkeyCtx(-hc) string createqueryedit
hotkey Context for the command.
-numberOfCommands(-nc) query
Return the number of run time commands.
-numberOfDefaultCommands(-ndc) query
Return the number of default run time commands.
-numberOfUserCommands(-nuc) query
Return the number of user run time commands.
-save(-s) edit
Save all the user run time commands.
-showInHotkeyEditor(-she) boolean createqueryedit
Indicate that this run time command should be shown in the Hotkey Editor. Default value is true.
-userCommandArray(-uca) query
Returns an string array containing the names of all the user run time commands.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

//    Create a command that simply prints a message.  After executing
//    the following lines enter the command name <i>MyHelloCommand</i>
//    in the Command Line.
//
if (!`runTimeCommand -exists MyHelloCommand`) {
    runTimeCommand
        -annotation "Print the word \"Hello\""
        -command ("print \"Hello\\n\"")
        MyHelloCommand;
}

//    Create a window with a button that invokes the <i>MyHelloCommand</i>
//    command.
//
window;
paneLayout;
button -command ("MyHelloCommand");
showWindow;