Preferences.SetPreferenceValue

Description

Sets a value for a specified preference.

Note: The "Interaction.autoinspect" preference cannot be changed permanently through scripting. For more information, see Property Editor Automatic Inspection.

Scripting Syntax

Preferences.SetPreferenceValue( PreferenceName, Value );

Parameters

Parameter Type Description
PreferenceName String The name of the preference to get. The syntax for specifying an individual preference is: "category.preference".
Value Variant The value to set.

Examples

1. Python Example

# 
# This example demonstrates how to temporarily change the user's
# AutoInspect preference (if enabled, property pages always pop
# up for objects newly created via command). It also illustrates
# how Softimage automatically reverts any scripting change to this 
# preference after the script runs.
# 
from win32com.client import constants as cns
app = Application
# Current value of AutoInspect
app.LogMessage( app.Preferences.GetPreferenceValue("Interaction.autoinspect") )
# Toggle the orginal value and re-log the value
app.Preferences.SetPreferenceValue( 
        "Interaction.autoinspect", 
        not( app.Preferences.GetPreferenceValue("Interaction.autoinspect") )
);
app.LogMessage( app.Preferences.GetPreferenceValue("Interaction.autoinspect") )
# If your AutoInspect preference was enabled originally, the History Log 
# would display the following:
# INFO : True
# INFO : False
# VERBOSE : Restoring preference changed by script: Interaction.autoinspect
# If your AutoInspect preference was disabled originally, the History Log 
# would display the following:
# INFO : False
# INFO : True
# VERBOSE : Restoring preference changed by script: Interaction.autoinspect

2. JScript Example

var app = Application;
app.LogMessage( app.Preferences.GetPreferenceValue("data_management.projects_auto_import_enable") );
app.Preferences.SetPreferenceValue("data_management.projects_auto_import_enable", true);
app.LogMessage( app.Preferences.GetPreferenceValue("data_management.projects_auto_import_enable") );
app.Preferences.SetPreferenceValue("data_management.projects_auto_import_enable", false);
app.LogMessage( app.Preferences.GetPreferenceValue("data_management.projects_auto_import_enable") );
// This script will log something like this:
// INFO : False
// INFO : True
// INFO : False

See Also

Preferences.GetPreferenceValue SetUserPref Preferences.Categories Preferences.Import Preferences.Export Preferences.RestoreDefault Preferences.SaveChanges