find position for active tab?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
joe88888
Newbie
Posts: 14
Joined: Wed Nov 22, 2006 4:56 pm

find position for active tab?

Post by joe88888 » Thu Oct 18, 2007 5:56 am

When I press the tab few times, it goes to a certain button. How can I find the location for that button? thank you!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Oct 18, 2007 6:09 am

Does this work for you?

GetCaretPos>X,Y,Relative

GetCaretPos retrieves the X, Y coordinates of the text caret (text cursor) of the foreground window. The coordinates are returned in the variables provided. Set Relative to 0 to return absolute screen coordinates, or 1 to return coordinates relative to the window.

From Help. Not to be confused with Get Cursor (mouse position)
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

joe88888
Newbie
Posts: 14
Joined: Wed Nov 22, 2006 4:56 pm

Post by joe88888 » Thu Oct 18, 2007 9:51 pm

not exact, I need to know x and y for the focused tabed button, the text cursor will not on that button

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Oct 19, 2007 2:42 am

If this is for a screen with a static design, perhaps this approach might work.

Make an array with the tab count and the x/y values for that tab count. Count the number of tabs pressed, and get the x/y values for that tab from the static array. Could keep a running count up/down depending on use of Tab/SH-Tab, from the last position.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

joe88888
Newbie
Posts: 14
Joined: Wed Nov 22, 2006 4:56 pm

Post by joe88888 » Fri Oct 19, 2007 12:06 pm

unfortunely, that tabed button is not static. the position sometimes change, but the numbers of tab pressed is same.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Oct 19, 2007 9:54 pm

It might help someone suggest a solution if you can tell us how you plan to use the coordinates after you have captured them.

joe88888
Newbie
Posts: 14
Joined: Wed Nov 22, 2006 4:56 pm

Post by joe88888 » Fri Oct 19, 2007 10:53 pm

I will use that x and y plus a value to click on another button which the tab can not go to. picture reconizing might help but it is a little too slow.

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