SetFlag (Command)

Description

Sets the state of one of the various flags that affects command behavior. You can get the value of a flag with Command.GetFlag.

You must call Command.Update if you want to update the definition of the command. In other words, the change is limited to the current command if the definition is not updated.

Scripting Syntax

    Command.SetFlag( Flag, [Enabled] )

C# Syntax

    Command.SetFlag( Int32, Boolean );

Parameters

Parameter | Type | Description
Flag | siCommandCapabilities | Flag to set.
Enabled | Boolean | True enables the flag (default), false disables it. Default Value: true

Examples

JScript Example

    /*
       JScript example demonstrating disabling of command logging
    */

    var cmd = Application.CreateCommand("CustomCmd") ;
    cmd.ScriptingName = "CustomCmd" ;
    cmd.Handler = "Foo" ;

    // Although we define the command with jscript
    // the embedded code is vbscript!
    cmd.Language = "VBScript" ;
    cmd.Code =
       "sub Foo()\n" +
       "   Logmessage \"CustomCmd called\" \n" +
       "end sub" ;

    cmd.ReturnValue = false ;
    cmd.SetFlag(siNoLogging);
    Application.AddCommand( cmd ) ;

    // Call the routine:
    Logmessage( "About to call custom cmd:" );
    CustomCmd() ;
    Logmessage( "Finished calling custom cmd" );

    // Result: In the script history the Logmessage call is shown
    // but the name CustomCmd is not logged.

    //INFO : About to call custom cmd:
    //INFO : CustomCmd called
    //INFO : Finished calling custom cmd

    //If we had not set the siNoLogging then this would be the logged results:

    /*
    //INFO : About to call custom cmd:
    //INFO : CustomCmd called
    CustomCmd();
    //INFO : Finished calling custom cmd
    */

    Application.RemoveCommand("CustomCmd")

See Also

Command.Update

Autodesk Softimage v7.5