Notifications
Clear all

[Closed] How to enter text in editText with UIAccessor and close dialoge

hi
on sweep modifier on extract shape i want to close and enter name for extracted spline.
i am able close the dialogue, how can i give new name in name field before closing

p=convertToSplineShape(Rectangle length:100 width:100)
cs=convertToSplineShape(Circle radius:15)
swp = sweep()
addModifier p swp
swp.CustomShape = 1	
swp.shapes[1] = cs
delete cs
select p

DialogMonitorOPS.unRegisterNotification id:#sweepExtract
	fn exShape = (
		local windowHandle = DialogMonitorOPS.GetWindowHandle()
		if (windowHandle != 0) then (
			local title = UIAccessor.GetWindowText WindowHandle
			if (title == "Extract Shape") then (
				
				controls = windows.getChildrenHWND windowHandle
				print controls[3][5]  -- this is edit text 
				
				UIAccessor.PressDefaultButton()
			)
		)
		return true
	)

	DialogMonitorOPS.RegisterNotification exShape id:#sweepExtract
	DialogMonitorOPS.Enabled = true
	
	$.modifiers[1].extractCustomSection()
	
	DialogMonitorOPS.unRegisterNotification id:#sweepExtract
	DialogMonitorOPS.Enabled = false

thanks

2 Replies

I couldn’t make it work in create mode without it throwing an exception ( tested in max 2014 only )
In modify mode it works as expected

...
DialogMonitorOPS.unRegisterNotification id:#sweepExtract
fn exShape =
(
	local windowHandle = DialogMonitorOPS.GetWindowHandle()
	if (windowHandle != 0) then (
		
		local title = UIAccessor.GetWindowText WindowHandle

		if (title == "Extract Shape") do
		(
			
			controls = windows.getChildrenHWND windowHandle
-- 			print controls
			
			windows.sendMessage controls[5][1] 0x201 1 0 -- set Instance mode
			windows.sendMessage controls[5][1] 0x202 0 0
			
			UIAccessor.SetWindowText controls[3][1] "ExtractedShape"			
			DialogMonitorOPS.unRegisterNotification id:#sweepExtract
			
			UIAccessor.PressDefaultButton()
			
		)
	)
	
	true
)

DialogMonitorOPS.RegisterNotification exShape id:#sweepExtract
DialogMonitorOPS.Enabled = true

max modify mode -- otherwise it throws ** system exception **
$.modifiers[1].extractCustomSection()

DialogMonitorOPS.Enabled = false

thank you for reply this is helpful,
can i add custom shape classes in build-inSection list on max 2020.
where is sweep.ini that is mentioned in older documentation.