Jump to content

Controlgetpos()


Recommended Posts

try this and see if it clicks the edit button

Opt("WinSearchChildren",1)
Opt("WinTitleMatchMode",4)
ControlClick("classname=WindowsForms10.window.8.app4","Guides","&Edit...")
Yes it does works. So do ControlClick("", "Guides", "&Edit") and ControlClick("","Guides",controlID). ControlClick("","Guides",controlID) doesn't work, though, when Opt("WinTitleMatchMode",4) is commented out. I wonder if that's the same problem I'm facing with ControlGetPos() when using the controlID.

However, the problem I'm facing is trying to click the 'X' close button in the top-right corner of the palette, which doesn't have a controlID, classNameNN, or text associated with it. So I need to get the position of the palette (which does have a controlID and classNameNN) and then click the coordinates where the 'X' is located.

Let me try setting Opt("WinTitleMatchMode",4) before calling ControlGetPos() with the controlID and see if that works.

Link to comment
Share on other sites

Well I've just discovered that the controlIDs do change, albeit randomly it seems, i.e. I can run through my test a few times and it will work, then randomly it won't and when I check, I notice the controlID has changed.

However, when it was working, I was using

Opt("WinTitleMatchMode",4)
$pos = ControlGetPos("","",controlID)

It would seem that for these types of controls, the title match mode needs to be set to 4 for it to work using the controlID.

Anyway, I've gone to using

$pos = ControlGetPos("","Guides","")
MouseClick("left", $pos[2] - 10, 10)

without having to fuss with setting the title match mode and it works spendidly.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...