Interface: WorkspaceManager

Interfaces > Core Interfaces > WorkspaceManager

 

   

Viewport Shading - Quick Navigation

   

Core Interfaces - Quick Navigation

   

The WorkspaceManager Core Interface exposes the features of the Manage Workspaces dialog to MAXScript.

Available in 3ds Max 2013 and higher.

   

   

Methods:

<bool>WorkspaceManager.CreateNewWorkspace <string>identifier <string>friendlyName

Creates a new Workspace with identifier string specified by the first argument and a user-friendly name specified by the second argument.

Returns True on success, False on failure.

   

<integer>WorkspaceManager.GetWorkspaceCount()

Returns the number of Workspaces.

   

<string>WorkspaceManager.GetWorkspaceIdentifier <index>index

Returns the Identifier of the indexed Workspace.

The index is 1-based.

   

<string>WorkspaceManager.GetWorkspaceName <index>index

Returns the User-friendly Name of the indexed Workspace.

The index is 1-based.

   

<string>WorkspaceManager.GetWorkspaceNameWithIdentifier <string>identifier

Returns the User-friendly Name of the Workspace with the given identifier string.

   

<string>WorkspaceManager.GetCurrentWorkspaceIdentifier()

Returns the identified or the current Workspace.

   

<bool>WorkspaceManager.SetCurrentWorkspaceByIdentifier <string>identifier

Sets the current Workspace to the one with the given identifier string.

Returns True on of the Workspace was set successfully, False if the identifier does not exist.

   

<bool>WorkspaceManager.DeleteWorkspace <string>identifier

Deletes the Workspace with the given identifier.

Returns True if the Workspace was deleted successfully, False if the identifier does not exist.

   

<String by value>WorkspaceManager.GetWriteDirectory()

Returns the Workspace storage path.

   

<bool>WorkspaceManager.SetWorkspaceName <index>index <string>name

Sets the name of the indexed Workspace to the name specified by the second argument.

The index is 1-based.

Returns True on success, False on failure.

   

<bool>WorkspaceManager.SetWorkspaceNameWithIdentifier <string>identifier <string>name

Sets the identifier string of the indexed Workspace to the name specified by the second argument.

Returns True on success, False on failure.

   

<bool>WorkspaceManager.ResetToDefaults <string>identifier

Resets the Workspace with the specified identifier string to defaults.

Returns True on success, False if the Workspace does not exist.

   

EXAMPLE

format "Workspaces Directory: %\n" (WorkspaceManager.GetWriteDirectory())
theCount = WorkspaceManager.GetWorkspaceCount() --get the number of workspaces
for i = 1 to theCount do --loop through them (one-based!) and print them all
(
	theID = WorkspaceManager.GetWorkspaceIdentifier i --get the identifier
	theName = WorkspaceManager.GetWorkspaceName i --get the user-friendly name
	format "%: ID:'%' Name:'%' \n" i theID theName --print the index, the identifier string and the name
)
currentID = WorkspaceManager.GetCurrentWorkspaceIdentifier() --get the current workspace's indentifier
currentName = WorkspaceManager.GetWorkspaceNameWithIdentifier currentID --get the current name
WorkspaceManager.CreateNewWorkspace "justtesting" "Testing" --create a new workspace
WorkspaceManager.SetCurrentWorkspaceByIdentifier "justtesting" --make the new workspace current
WorkspaceManager.SetCurrentWorkspaceByIdentifier currentID --set the previous workspace as current
WorkspaceManager.SetWorkspaceName (theCount+1) "ToDelete" --rename the new workspace by index
WorkspaceManager.SetWorkspaceNameWithIdentifier "justtesting" "NoReally" --rename the new workspace by identifier
WorkspaceManager.DeleteWorkspace "justtesting" --delete the new workspace by identifier

LISTENER OUTPUT

Workspaces Directory: C:\Users\YourName\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\en-US\UI\Workspaces
2
1: ID:'alternate' Name:'Alternate' 
2: ID:'standard' Name:'Standard' 
"standard"
"Standard"
true
true
true
true
true
true

   

<bool>WorkspaceManager.GetRunScript <string>identifier

Returns the state of the Run Script option for the Workspace with the given identifier.

When it is True, the Entry and Exit Scripts associated with the Workspace will be executed.

When set to False, the scripts will be ignored.

<void>WorkspaceManager.ToggleRunScript <string>identifier

Toggles the Run Script option of the Workspace with the given identifier.

This can be used together with WorkspaceManager.GetRunScript to change the state of the option.

For example, to turn the option on, you can check if it is currently set to False and toggle it if it is.

EXAMPLE

theWS = WorkspaceManager.GetWorkspaceIdentifier 1
if not (WorkspaceManager.GetRunScript theWS) do WorkspaceManager.ToggleRunScript theWS

   

<filename>WorkspaceManager.GetEntryScript <string>identifier

Returns the filename of the Entry Script associated with the Workspace with the given identifier.

The Entry Script is a MAXScript which is executed when the Workspace is loading.

<bool>WorkspaceManager.SetEntryScript <string>identifier <filename>script

Associates the Entry Script filename specified by the second argument with the Workspace given by the identifier passed as first argument.

Returns True on success, False if the identifier does not represent an existing Workspace.

Note that this method does not check whether the specified script is valid or even exists at the specified path.

   

<filename>WorkspaceManager.GetExitScript <string>identifier

Returns the filename of the Exit Script associated with the Workspace with the given identifier.

The Exit Script is a MAXScript that is executed when the Workspace is exiting due to another Workspace being loaded.

<bool>WorkspaceManager.SetExitScript <string>identifier <filename>script

Associates the Exit Script filename specified by the second argument with the Workspace given by the identifier passed as first argument.

Returns True on success, False if the identifier does not represent an existing Workspace.

Note that this method does not check whether the specified script is valid or even exists at the specified path.

   

<integer>WorkspaceManager.GetAllSubsystemsCount()

Returns the number of all sub-systems.

   

<string>WorkspaceManager.GetSubsystemName <index>index

Returns the name of the indexed sub-system.

   

<bool>WorkspaceManager.IsSubsystemSaving <string>identifier <string>subSystemIdentifier

Returns True if the sub-system specified by name by the first argument will be saved when the Workspace with the identifier given by the second argument is saving, False otherwise.

<bool>WorkspaceManager.ToggleSubsystemSaving <string>identifier <string>subSystemIdentifier

Toggles whether the indexed sub-system specified by the first argument will be saved when the Workspace with the identifier given by the second argument is saving.

Returns the new saving state.

   

<bool>WorkspaceManager.IsSystemWorkspace <string>identifier

Returns True if the Workspace specified by the given identifier is a system workspace, False if it is not.

   

EXAMPLE

for w = 1 to WorkspaceManager.GetWorkspaceCount() do
(
	theWS = WorkspaceManager.GetWorkspaceIdentifier w
	theWSName = WorkspaceManager.GetWorkspaceName w
	isSystem = WorkspaceManager.IsSystemWorkspace theWS
	format "\n%:% Workspace ID: % | Name:\"%\"\n" w (if isSystem then "SYSTEM" else "Custom") theWS theWSName
	for i = 1 to WorkspaceManager.GetAllSubsystemsCount() do 
	(
		theName = (WorkspaceManager.GetSubsystemName i)
		isSaving = (WorkspaceManager.IsSubsystemSaving theName theWS)
		format "\t%: % | isSaving:%\n" i theName isSaving
	)
)

SAMPLE OUTPUT

1:SYSTEM Workspace ID: Workspace1 | Name:"Workspace: Default"
	1: kMeta | isSaving:false
	2: kCui | isSaving:true
	3: kViewportPresets | isSaving:false
	4: kMenu | isSaving:true
	5: kHotkeys | isSaving:false
	6: kRibbon | isSaving:false

2:Custom Workspace ID: Workspace2 | Name:"Alternate Layout"
	1: kMeta | isSaving:false
	2: kCui | isSaving:true
	3: kViewportPresets | isSaving:false
	4: kMenu | isSaving:true
	5: kHotkeys | isSaving:false
	6: kRibbon | isSaving:false

3:Custom Workspace ID: Workspace3 | Name:"Viewport Layout Tab Presets"
	1: kMeta | isSaving:false
	2: kCui | isSaving:true
	3: kViewportPresets | isSaving:false
	4: kMenu | isSaving:true
	5: kHotkeys | isSaving:false
	6: kRibbon | isSaving:false
OK