Jump to content

Recommended Posts

Posted

Hi, I just start to learn Autoit, right now I am working on something that needs to simulate a mouse click on selected text. The scenario is like this:

I open a webpage, then there is a message box popping up, I need to click the OK button on that message box. The annoying thing is that, I cannot use keyboard to control the OK button (TAB or ENTER or else doesnโ€™t work). So I want to use a mouse click instead, however, the message box keeps on changing its position each time I reload the webpage, which gives me a big headache.

I suppose my way to solve the problem should be like this:

Step 1: search for text โ€œOKโ€ on the screen

Step 2: select the text โ€œOKโ€

Step 3: get the โ€“x, -y position value (or range) of the selected text

Step 4: then use mouseclick() to click on the button

But I am not sure whether Autoit has such a function for Step 3, I read through the help file but couldnโ€™t find any clue. Can anyone give me some hints on this? Or suggest a new approach?

Thanks a lot!

Posted

Use ControlClick(), and see "Controls" in the help file for all the ways you can specify the control, including by text:

ControlClick("Your Popup Title", "", "[CLASS:Button; TEXT:OK]")

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
ร—
ร—
  • Create New...