Interface: actionMan

Interfaces > Core Interfaces > actionMan

The actionMan Interface provides MAXScript access to the ActionTables and ActionItems introduced in 3ds Max 4 to represent the actions that can be assigned to Toolbars, Menus, QuadMenus and Keyboard Shortcuts using the Customize User Interface dialog. ActionItems include MacroScripts created using the Macro Recorder or written manually by a MAXScript user. This interface provides methods for executing actions and for managing Keyboard Shortcuts files as well as access to the ActionTables and through them the ActionItems MixinInterfaces, which are documented at the end of this topic.

   

Properties:

actionMan.numActionTables : integer : Read

Contains the number of Action Tables registered with the Action Manager. Read-only.

   

Methods:

<boolean>actionMan.executeAction <integer>tableId <string>persistentId 	 

Executes the action specified by the table ID and persistent ID.

Returns True if successful, False otherwise.

You can get an action's IDs by enabling the MacroRecorder and performing actions in the 3ds Max User Interface. Actions that can be performed only using the actionMan interface will appear as actionMan.executeAction() calls with the corresponding IDs.

FOR EXAMPLE

  • Enable MacroRecorder.

  • Go to Main Menu > Tools > Selection Floater.

  • The MacroRecorder will display the code:

actionMan.executeAction 0 "40266" -- Selection: Selection Floater

   

<boolean>actionMan.loadKeyboardFile <filename>file   

Loads the keyboard shortcuts settings from the specified file.

Returns True if successful and False otherwise.

   

<boolean>actionMan.saveKeyboardFile <filename>file 

Saves the keyboard shortcuts settings to the specified filename.

Returns True if successful and False otherwise.

   

<filename>actionMan.getKeyboardFile() 

Returns the filename of the current keyboard shortcuts file.

EXAMPLE

actionMan.getKeyboardFile()
"C:\Program Files\Autodesk\3ds Max 2008\UI\MaxStartUI.kbd"
<Interface>actionMan.getActionTable <index>index

Returns the <MixinInterface:ActionTable> of the indexed Action Table.

The index must be in the range of 1 to actionMan.numActionTables .

   

ActionTable MixinInterface

Properties:

<ActionTable>.id : DWORD : Read

Contains the ID of the ActionTable. Read-only.

   

<ActionTable>.name : string : Read

Contains the Name of the ActionTable. Read-only.

   

<ActionTable>.contextID : DWORD : Read

Contains the ContextID of the ActionTable. Read-only.

   

<ActionTable>.contextName : string : Read

Contains the Context Name of the ActionTable. Read-only.

   

<ActionTable>.numActionItems : integer : Read

Contains the number of ActionItems in the ActionTable. Read-only.

   

Methods:

<Interface><ActionTable>.getActionItem <index>index

Returns the <MixinInterface:ActionItem> of the indexed Action Item.

The index must be between 1 and <ActionTable>.numActionItems.

   

ActionItem MixinInterface

Properties:

<ActionItem>.id : DWORD : Read

Contains the ID of the ActionItem.

   

<ActionItem>.isVisible : boolean : Read

Contains the Visible state of the ActionItem as determined by its isVisible event handler.

   

<ActionItem>.isEnabled : boolean : Read

Contains the Enabled state of the ActionItem as determined by its isEnabled event handler.

   

<ActionItem>.isChecked : boolean : Read

Contains the Checked state of the ActionItem as determined by its isChecked event handler.

   

Methods:

<void><ActionItem>.getDescription <&String>text

text is Out parameter

Sets the by-reference argument to the ActionItem's Description.

   

<void><ActionItem>.getCategory <&String>text

text is Out parameter

Sets the by-reference argument to the ActionItem's Category.

   

<void><ActionItem>.getButtonText <&String>text

text is Out parameter

Sets the by-reference argument to the text that will be displayed on a button when the ActionItem is assigned to a Toolbar.

   

<void><ActionItem>.getMenuText <&String>text

text is Out parameter

Sets the by-reference argument to the text that will be displayed when the ActionItem is assigned to a Menu or QuadMenu.

   

<boolean><ActionItem>.hasIcon()

Returns True if the ActionItem has an icon associated with it, False if the ActionItem has no icon.

   

<bool><ActionItem>.getIconFileName <&String>fileName

fileName is Out parameter

Sets the by-reference argument to the Icon file name, or to "" if no Icon file is associated with the ActionItem.

Returns True on success, False if no Icon file is associated with the ActionItem.

   

<index><ActionItem>.getIconIndex()

Returns the index of the Action Item's Icon within the Icon file, or 0 if there is no icon associated with it (<ActionItem>.hasIcon() returns false ).

   

EXAMPLE

for i = 1 to actionMan.numActionTables-1 do 
(
	atbl = actionMan.getActionTable i
	format "% ID:% Name:'%' ContextID:% ContextName:'%' NumActionItems:%\n" i atbl.id atbl.name atbl.contextID atbl.contextName atbl.numActionItems
	for j = 1 to atbl.numActionItems do
	(
		aitm = atbl.getActionItem j
		aitm.getDescription &desc 
		aitm.getCategory &cat
		aitm.getButtonText &btn
		aitm.getMenuText &mnu
		hasicon = aitm.hasIcon()
		if hasicon then
		(
			aitm.getIconFileName &iconfile 
			iconfile = filenamefrompath iconfile 
			iconindex = aitm.getIconIndex()
			format "\t% ID:% Desc:'%' Cat:'%' BtnTxt:'%' MnuTxt:'%' Icon:[%,%] \n" j aitm.id desc cat btn mnu iconfile iconindex
		)
		else
			format "\t% ID:% Desc:'%' Cat:'%' BtnTxt:'%' MnuTxt:'%'\n" j aitm.id desc cat btn mnu 
	)
)

PARTIAL OUTPUT

...
3 ID:-1159893849 Name:'Render' ContextID:0 ContextName:'Main UI' NumActionItems:1
	1 ID:36864 Desc:'Render Message Window Toggle' Cat:'Render' BtnTxt:'Render Message Window...' MnuTxt:'Render Message Window...'
4 ID:1724956863 Name:'Asset Tracking System' ContextID:0 ContextName:'Main UI' NumActionItems:2
	1 ID:0 Desc:'Generate Proxies' Cat:'Asset Tracking System' BtnTxt:'Generate Proxies' MnuTxt:'Generate Stale Proxies'
	2 ID:1 Desc:'Set Proxy Resolution...' Cat:'Asset Tracking System' BtnTxt:'Set Proxy Resolution...' MnuTxt:'Set Proxy Resolution...'
5 ID:161818329 Name:'FixAmbientActions' ContextID:2 ContextName:'Material Editor' NumActionItems:2
	1 ID:1 Desc:'Fix Ambient All' Cat:'Utilities' BtnTxt:'Fix Ambient All' MnuTxt:'Fix Ambient All'
	2 ID:2 Desc:'Fix Ambient Selected' Cat:'Utilities' BtnTxt:'Fix Ambient Selected' MnuTxt:'Fix Ambient Selected'
6 ID:132537306 Name:'MMCleanActions' ContextID:2 ContextName:'Material Editor' NumActionItems:1
	1 ID:1 Desc:'Clean  MultiMaterial' Cat:'Utilities' BtnTxt:'Clean  MultiMaterial' MnuTxt:'Clean MultiMaterial...'
7 ID:4745576 Name:'InstanceDuplMapActions' ContextID:2 ContextName:'Material Editor' NumActionItems:1
	1 ID:1 Desc:'Instance Duplicate Map' Cat:'Utilities' BtnTxt:'Instance Duplicate Map' MnuTxt:'Instance Duplicate Map...'
8 ID:-1682387772 Name:'Scene State Manager' ContextID:0 ContextName:'Main UI' NumActionItems:3
	1 ID:4096 Desc:'Save Scene State' Cat:'Scene State' BtnTxt:'Save Scene State...' MnuTxt:'Save Scene State...'
	2 ID:4112 Desc:'Scene State Manager Dialog Toggle' Cat:'Scene State' BtnTxt:'Manage Scene States...' MnuTxt:'Manage Scene States...'
	3 ID:8192 Desc:'Restore Scene State' Cat:'Scene State' BtnTxt:'Restore Scene State' MnuTxt:'Restore Scene State'
9 ID:-1172021248 Name:'Containers' ContextID:0 ContextName:'Main UI' NumActionItems:17
	1 ID:0 Desc:'Inherit Container' Cat:'Containers' BtnTxt:'Inherit Container' MnuTxt:'Inherit Container' Icon:[Containers,6] 
	2 ID:1 Desc:'Create Container from Selection' Cat:'Containers' BtnTxt:'Create Container from Selection' MnuTxt:'Create Container from Selection' Icon:[Containers,4] 
	3 ID:2 Desc:'Add Selected to Container' Cat:'Containers' BtnTxt:'Add Selected to Container' MnuTxt:'Add Selected to Container' Icon:[Containers,2] 
	4 ID:3 Desc:'Remove Selected from Container' Cat:'Containers' BtnTxt:'Remove Selected from Container' MnuTxt:'Remove Selected from Container' Icon:[Containers,12] 
	5 ID:4 Desc:'Unload Container' Cat:'Containers' BtnTxt:'Unload Container' MnuTxt:'Unload Container' Icon:[Containers,14] 
	6 ID:5 Desc:'Load Container' Cat:'Containers' BtnTxt:'Load Container' MnuTxt:'Load Container' Icon:[Containers,7] 
	7 ID:6 Desc:'Close Container' Cat:'Containers' BtnTxt:'Close Container' MnuTxt:'Close Container' Icon:[Containers,3] 
	8 ID:7 Desc:'Open Container' Cat:'Containers' BtnTxt:'Open Container' MnuTxt:'Open Container' Icon:[Containers,9] 
	9 ID:8 Desc:'Save Container' Cat:'Containers' BtnTxt:'Save Container' MnuTxt:'Save Container' Icon:[Containers,13] 
	10 ID:9 Desc:'Update Container' Cat:'Containers' BtnTxt:'Update Container' MnuTxt:'Update Container' Icon:[Containers,1] 
	11 ID:10 Desc:'Reload Container' Cat:'Containers' BtnTxt:'Reload Container' MnuTxt:'Reload Container' Icon:[Containers,11] 
	12 ID:11 Desc:'Make All Content Unique' Cat:'Containers' BtnTxt:'Make All Content Unique' MnuTxt:'Make All Content Unique' Icon:[Containers,15] 
	13 ID:12 Desc:'Merge Container Source' Cat:'Containers' BtnTxt:'Merge Container Source' MnuTxt:'Merge Container Source' Icon:[Containers,8] 
	14 ID:13 Desc:'Edit Container' Cat:'Containers' BtnTxt:'Edit Container' MnuTxt:'Edit Container' Icon:[Containers,5] 
	15 ID:14 Desc:'Override Object Properties' Cat:'Containers' BtnTxt:'Override Object Properties' MnuTxt:'Override Object Properties' Icon:[Containers,10] 
	16 ID:15 Desc:'Select Content's Container' Cat:'Containers' BtnTxt:'Select Content's Container' MnuTxt:'Select Content's Container' Icon:[Containers,16] 
	17 ID:16 Desc:'Override All Locks' Cat:'Containers' BtnTxt:'Override All Locks' MnuTxt:'Override All Locks' Icon:[Containers,18] 
...

All Action Items are macro recorded when executed. This includes main menu items, CUI buttons, keyboard shortcuts, and quad menu items.

See Also