Klick a button with no name.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Klick a button with no name.

Post by rullbandspelare » Thu Feb 24, 2011 5:50 pm

I have a window with two buttons that I would like to klick. But they have no name. Is it possible to "adress" a button by its position or window handle instead of its name?

"View system windows" snipet:
...
67058 - SysDateTimePick32 ""
67060 - Button ""
67062 - Button ""

Dont work:
Let>WIN_USEHANDLE=1
MouseOver>Edit new,67062

Works:
SetControlText>Edit new,Button,2,Hello
MouseOver>Edit new,Hello

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Feb 24, 2011 9:38 pm

Probably the easiest thing is to use MouseMoveRel> and a LCLICK.

Get the coordinates of the button within the window then use MouseMoveRel> and the X,Y coordinates that are "relative" to the window. Using MouseMoveRel> rather than MouseMove> prevents problems when the window is not located in exactly the same position each time.

It might also be possible to acquire the handle of the button objects and move to their locations based on coordinates obtained using GetWindowPos>. This is a more drawn out process so if you can use predefined coordinates it is much simpler.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts