SetItem (Environment)

Introduced

4.0

Description

Sets the specified system environment variable. If the specified environment variable doesn't exist, one is created.

Note: This method should be used by Python scripters who need to set an environment variable through scripting. Since the Environment.Item property is not settable for Python users, this method is a workaround. For more information (and instructions for setting up Python COM support for XSIUtils), see Environment.Item.

Scripting Syntax

    Environment.SetItem( Name, Value )

C# Syntax

    Environment.SetItem( String in_bstrName, String newVal );

Parameters

Parameter | Type | Description
Name | String | The name of the system environment variable.
Value | String | New value for system environment variable,

Examples

1. VBScript Example

    ' This example illustrates how to create and set a system environment variable,
    call XSIUtils.Environment.SetItem("MYVAR",  1 )
    call logmessage( "MYVAR=" & XSIUtils.Environment("MYVAR" ) )

2. JScript Example

    // This example illustrates how to create and set a system environment variable,
    XSIUtils.Environment.SetItem("MYVAR",  1 );
    LogMessage( "MYVAR=" + XSIUtils.Environment("MYVAR" ) );

3. PerlScript Example

    # This example illustrates how to create and set a system environment variable,
    $XSIUtils->Environment->SetItem("MYVAR",  1 );
    $Application->LogMessage( "MYVAR=" . $XSIUtils->Environment->Item("MYVAR" ) );

4. Python Example

    # This example illustrates how to create and set a system environment variable,
    XSIUtils.Environment.SetItem("MYVAR",  1 )
    Application.LogMessage( "MYVAR=" + XSIUtils.Environment.Item("MYVAR" ) )

Autodesk Softimage v7.5