"Pick from object" hotkey script not working anymore (2024)

"Pick from object" hotkey script not working anymore (2024)

Anonymous
Not applicable
818 Views
1 Reply
Message 1 of 2

"Pick from object" hotkey script not working anymore (2024)

Anonymous
Not applicable

Hi! I use this script in 2023 to simulate the "pick material from object" button in SME, but since they've changed SME quite a lot, it's not working anymore and i have no idea how the person managed to make the "windows.Message" work in the first place.



 

(
	if MatEditor.mode == #basic then
	(	
		MatEditor.open() -- force basic medit in to focus, otherwise it won't work
		actionMan.executeAction 2 "1101"
	)
	else
	(
		if not SME.IsOpen() do SME.Open()
 
		fn GetSMEWindowHandle = 
		(	
			max_hwnd = windows.getMAXHWND()
			for m in windows.getChildrenHWND 0 where m[4] == "NodeJoeMainWindow" and m[6] == max_hwnd do exit with m[1]		
		)
 
		local sme_hwnd = GetSMEWindowHandle()
 
		windows.sendMessage sme_hwnd 0x111 41005 0
 
	)
)

 


The error i get now in 2024 is
"Type error: windows.sendMessage requires Rollout, RolloutFloater or Integer value, got: OK"

From what i've learned, the "NodeJoeMainWindow" is no more. Now it's "Qt5151QWindowIcon" instead, using a simple Window Spy.

Can anybody help? I just need a script that opens SME and pushes the (before) "Pick Material from Object" or (now) "Pick from Object".

Thanks!

0 Likes
819 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I tried the 'right' way, but ended up doing the 'wrong'/ugly way, but it works, nevertheless.

AHK script

 

#Persistent
#SingleInstance, Force
#IfWinActive, Autodesk 3ds Max

; Block mouse (and keyboard) input
BlockInput, Default

; Sequence to simulate
Send, {Alt Down}
;Sleep, 10

Send, {Alt Up}

Sleep, 10

Send, {Right}
Sleep, 10

Send, {Down}
Sleep, 10

Send, {Enter 2}

#IfWinActive  ; End the specific window context

; Unblock mouse (and keyboard) input
BlockInput, Off

; Make ESC close the script
Esc::ExitApp

return

 and maxscript

macroScript PickMaterialSME24
Category:"PickMaterialSME24"	
toolTip:"PickMaterialSME24" 
buttontext:"PickMaterialSME24"
	
(
 SME.close() 
 SME.Open()
		
 ahkScriptPath = "E:\\script.ahk" --path to script
 shellLaunch "autohotkey.exe" ahkScriptPath
 
)

I hope it helps!


0 Likes