Maxscript to select radio buttons in the Proboolean Command Panel

I had this code that worked untill 3dsmax 2020, but I can't get it to work now in 3dsmax 2021 (and probablty 2022):

	fn priv_proboolean_Extract_pressRadioButton_2018 rbName state =  (
		local properRb = false
		local BN_CLICKED = 0 																					-- clicky message ID
		local BM_SETCHECK = 241 																			-- checkbutton toggle message ID
		local WM_COMMAND = 273 																			-- windows command message
		local panelName = if((maxVersion())[1] >= 19000) then "MaxSDK::QMaxTabWidgetClassWindow" else "ModifyTask"	--QWidget instead of "ModifyTask"
		max modify mode
		for child in (windows.getChildrenHWND #max)  where child[5] == "CommandPanelWindow" do (
			for classN in (windows.getChildrenHWND child[1]) where (classN[5] == panelName)  do ( 				
				for btn in (windows.getChildrenHWND classN[1]) do
				(
					if btn[5] == "Extract Selected" do properRb = true
					if properRb == true and (btn[5] == rbName) do
					(						
						local parent = UIAccessor.getParentWindow btn[1]
						local id = UIAccessor.getWindowResourceID btn[1]
						windows.sendMessage btn[1] BM_SETCHECK (if state then 1 else 0) 0
						If state then windows.sendMessage parent WM_COMMAND ((bit.shift BN_CLICKED 16) + id) btn[1]
						if((maxVersion())[1] >= 19000) then return OK  ))))),

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
OccultArt's picture

Thanks, thats great! How do I

Thanks, that's great! How do I know the ID of all the other radio buttons beside the extract operation remove copy instance? Like the radio buttons in Pick boolean type, Operation type, Display type, and the pick boolean? Could you please make it work for all the radio buttons in the Proboolean menu?

I do not know anything about this code myself, I just used code I got as a request for this same problem a few years ago. My 3dsmax scripting knowledge is not near the level I would need to understand this code. I can write clean Maxscript functions, but not these types of windows interactions.

Swordslayer's picture

 

Use the hwnd viewer, it also shows the resource ID.

OccultArt's picture

Can't download/find the HWND script

Thanks!

Swordslayer's picture

 

Why so complicated, send a click to it, that should always work:

fn setProbooleanExtractOption option =
(
	local BM_CLICK = 0x00F5
	local iGlobal =  (dotNetClass "Autodesk.Max.GlobalInterface").Instance
	local id = case option of (#remove: 1038; #copy: 1039; #instance: 1040)
	local commandPanelHWnd = (windows.getHWndData (iGlobal.UtilGetCoreInterface16()).CommandPanelRollup.Hwnd)[7]
 
	for wnd in windows.getChildrenHWnd commandPanelHWnd where UIAccessor.getWindowResourceID wnd[1] == id do
		windows.sendMessage wnd[1] BM_CLICK 0 0		
)
setProbooleanExtractOption #copy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.