## Command.Update

### Description

Commits changes to the current command to the command definition. Subsequent calls to the command need to match the new definition of the command. In other words, this allows you to change the behavior and signature of a command after it is added with XSIApplication.AddCommand.
Alternatively, you could remove the command completely (with XSIApplication.RemoveCommand) and redefine it from scratch.
Warning: Extra care must be taken when you update the definition of a command because it might break scripts that are relying on it.
Note: You cannot update the definition of built-in commands.

### C# Syntax

    Command.Update();

### Scripting Syntax

    Command.Update();

### Examples

#### JScript Example

    /*
            This example demonstrates how to update a command definition
    */
    var cmd = Application.CreateCommand("CustomCmd") ;
    cmd.ScriptingName = "CustomCmd" ;
    cmd.Handler = "CmdImpl" ;
    // Although we define the command with jscript
    // the embedded code is vbscript!
    cmd.Language = "JScript" ;
    cmd.Code = CmdImpl.toString() ;
    Application.AddCommand( cmd ) ;
    // Now the command has been added to Softimage
    // but our definition doesn't match CmdImpl,
    // which expects an argument.
    // If we try to call the custom command
    // we see that things are not working properly
    try
    {
            // Logs: CmdImpl called: undefined
            CustomCmd();
            // Causes error "Wrong number of arguments..."
            CustomCmd(1);
    }
    catch( e )
    {
    }
    // Now fix the command
    cmd = Commands.Item("CustomCmd");
    // Add a new argument with a default value of 1.
    cmd.Arguments.Add("Arg1", siArgumentInput, 1);
    // Commit changes.  Please note that all the changes would be local to
    // cmd if Update is not called.
    cmd.Update();
    //Logs: CmdImpl called: 1
    CustomCmd();
    //Logs: CmdImpl called: 24
    CustomCmd(24);
    // Cleanup
    Application.RemoveCommand( "CustomCmd" ) ;
    // This is the implementation of the custom command
    function CmdImpl( arg1 )
    {
            Logmessage( "CmdImpl called: " + arg1 ) ;
            return arg1 ;
    }

### See Also

Command.GetFlag Command.SetFlag Command.Arguments Command.Handler ArgumentCollection.Add ArgumentCollection.Remove