Click hwnd button


#1

Hey guys

I’m trying to click on the “Update Effect” button (Environment and Effects window -> Effects tab).
I used a script that shows the hwnd parent/child to know exactly the ID I have to use:

So I tried this:
UIAccessor.PressButtonByName 1118740P "Update Effect"
but it returns: false.

I also tried another way:
envEffectsDialog.Open()
env_hwnd = windows.getChildHWND 0 “Environment and Effects” parent:#max
a = UIAccessor.PressButtonByName env_hwnd "Update Effect"
print a
but it returns undefined

Help please! :slight_smile:


#2

name ≠ text , name is private , only author know it , and even if you get the name , the syntax still invalid
to press button , use PressButton , otherwise SendMessage

dialogHWND =  windows.getChildHWND 0 "Environment and Effects"
dialogChildren = windows.getChildrenhwnd dialogHWND[1]
for child in dialogChildren where child[4] == "Button" and child[5] == "Update Effect" do 
	UIAccessor.pressButton child[1]

#3

I suppose this will work in english max versions only

if envEffectsDialog.isOpen() do
(
    local dialog = windows.getChildHWND 0 "Environment and Effects" parent:#max
    local update_button = (windows.getChildHWND dialog[1] "Update Effect")[1]
		
    UIAccessor.PressButton update_button
)

#4

Thank you guys!

Is there a way to make it work without opening the env&effect dialog?


#5

Even though it works can you guys tell me a bit more about it? It’d like to easily do it on my own with those parameters;

but hwnd are still a bit blurry for me.