I feel like I should have been able to figure this out based on the help I’ve received previously, but I have to admit I still haven’t even slightly been able to wrap my mind around working with windowhandles
I’m trying to retrieve all open tabs in the script editor, the reason is that I want my script to close all open tabs that are not edited (does not have “*” in their title). I am able to retrieve the tab that I execute the script from, but I haven’t been able to retrieve all of the other tabs.
Here’s what I got so far:
g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
theMXSEditor = (g).theMXSEditorInterface
-- Get windowhandle of the MXS Editor
theMXSEditor_hwnd = theMXSEditor.EditorGetMainHWND
-- Get the number of tabs open in the MXS Editor
theMXSEditor_numTabs = theMXSEditor.EditorNumberDocuments
-- Try to retrieve open tabs in the editor
theMXSEditor_childs = (for i in (windows.getChildrenHWND theMXSEditor_hwnd) where i[4] == "MXS_Scintilla" collect i)
-- theMXSEditor_childs.count is less than the number of open tabs
So the “theMXSEditor.EditorNumberDocuments” returns the correct number of open tabs, but when I try to retrieve them by searching the children of “theMXSEditor_hwnd” I get a different result. It also seems like I get a lot of duplicates.
I was hoping someone could nudge me in the right direction?
EDIT: I’ve also tried to find out how the hotkey works (CTRL+TAB // CTRL+SHIFT+Tab), these shift through the tabs in the editor. However, they’re not specified in the hotkey editor, so I guess the MXS Editor has a separate configuration of hotkeys. Is it possible to find the code that runs when these hotkeys are used? Or are these hardcoded into the editor?