Interface: UIAccessor
The UIAccessor Core Interface provides methods to collect data and interact with dialogs and popups in the 3ds Max User Interface. It can be used in conjunction with the Interface: DialogMonitorOPS to perform automated UI handling using a callback function.
Available in 3ds Max 9 and higher.
Methods:
<string>UIAccessor.GetWindowText <HWND>hwnd
Returns the caption of the window with the given handle.
<string>UIAccessor.GetWindowClassName <HWND>hwnd
Returns the window class name of the window with the given handle.
<integer>UIAccessor.GetWindowResourceID <HWND>hwnd
Returns the window resource ID of the window with the given handle.
<HWND by value array>UIAccessor.GetChildWindows <HWND>hwnd
Returns an array with the handles of all child windows of the window with the given handle. If a child window has child windows on its own, these will also be enumerated.
<HWND by value array>UIAccessor.GetPopupDialogs()
Returns a handles array of the pop up dialogs.
<HWND>UIAccessor.GetParentWindow <HWND>hwnd
Returns the parent window's handle of the window with the given handle.
<HWND>UIAccessor.GetFirstChildWindow <HWND>hwnd
Returns the handle of the first child of the window with the given handle.
<HWND>UIAccessor.GetPrevWindow <HWND>hwnd
Returns the handle of the previous sibling with the same parent as the window with the given handle.
<HWND>UIAccessor.GetNextWindow <HWND>hwnd
Returns the handle of the next sibling with the same parent as the window with the given handle.
<boolean>UIAccessor.IsWindow <HWND>hwnd
Returns true if the UI element with the given handle is a window, false otherwise.
<string>UIAccessor.GetWindowDllFileName <HWND>hwnd
Returns the DLL file name of the window with the given handle.
<string>UIAccessor.GetWindowDllDescription <HWND>hwnd
Returns the DLL description string of the window with the given handle.
<void>UIAccessor.CloseDialog <HWND>hwnd
Closes the dialog with the given window handle.
<void>UIAccessor.PressDefaultButton()
Presses the default button in the currently active dialog. This method simulates pressing the Enter key.
<void>UIAccessor.PressButton <HWND>hwnd
Presses the button with the given handle.
<boolean>UIAccessor.PressButtonByName <HWND>hwnd <string>name
Presses the button with the name equal to the second argument in the dialog with the handle given as the first argument.
<boolean>UIAccessor.SetWindowText <HWND>hwnd <string>text
Sets the title text of the dialog with the given handle.
<boolean>UIAccessor.SendMessageID <HWND>hwndDlg <enum>ID
ID enums: {#IDOK|#IDCANCEL|#IDABORT|#IDRETRY|#IDIGNORE|#IDYES|#IDNO|#IDCLOSE}
Sends the message ID given in the second argument to the window with the given handle.
<boolean>UIAccessor.SendMessage <HWND>hwndDlg <integer>MessageID <integer>wParam <integer>lParam
Sends the integer message ID, wParam, and lParam given in the second, third, and fourth arguments to the window with the handle given as the first argument.
EXAMPLE
DialogMonitorOPS.unRegisterNotification id:#eyeInTheSky fn dmnotification = ( WindowHandle = DialogMonitorOPS.GetWindowHandle() format "Dialog Window Handle: %\n" WindowHandle format "Dialog Name: %\n" (UIAccessor.GetWindowText WindowHandle) format "Window Class Name: %\n" (UIAccessor.GetWindowClassName WindowHandle) format "Window Resource ID: %\n" (UIAccessor.GetWindowResourceID WindowHandle) format "Is Window: %\n" (UIAccessor.isWindow WindowHandle) format "Window DLL Filename: %\n" (UIAccessor.GetWindowDllFileName WindowHandle) format "Window DLL Description: %\n" (UIAccessor.GetWindowDllDescription WindowHandle) UIAccessor.SetWindowText WindowHandle" All Your Windows Are Belong To Us" format "=====================\n" true ) DialogMonitorOPS.RegisterNotification dmnotification id:#eyeInTheSky DialogMonitorOPS.Enabled = true DialogMonitorOPS.ShowNotification()
If you evaluate the code above and open Main Menu > Customize > Customize User Interface, the output will look like this:
Dialog Window Handle: 3213306 Dialog Name: Window Class Name: Menu Window Resource ID: 0 Is Window: true Window DLL Filename: C:\Program Files\Autodesk\3ds Max 2008\3dsmax.exe Window DLL Description: ===================== Dialog Window Handle: 2033898 Dialog Name: Window Class Name: SysShadow Window Resource ID: 0 Is Window: true Window DLL Filename: C:\Program Files\Autodesk\3ds Max 2008\3dsmax.exe Window DLL Description: ===================== Dialog Window Handle: 3278842 Dialog Name: Customize User Interface Window Class Name: Dialog Window Resource ID: 0 Is Window: true Window DLL Filename: C:\Program Files\Autodesk\3ds Max 2008\CustDlg.dll Window DLL Description: =====================
The first block returns information about the Customize Menu. A Menu does not have a Dialog Name, but is also a form of window.
The second block shows the shadow of the menu (if enabled in the MS Windows settings).
The third block shows the actual Customize User Interface dialog.