Jump to content

Ask autoit to look for a picture and click it when it pops up


Recommended Posts

Hi all

I have a main command I want auto it to do. Its fairly simple and I can get auto it to do this. But while it is doing this:

I have a series of pictures I need auto it to click when they appear on my screen. How do I ask auto it to look for these saved images and click them in the appropriate locations?

For example:

i want auto it to search for a red button with an x on it so I save the pic for it to look for on my desktop. It appears and I want auto it to move the mouse to (690, 726) and click down with the left button.

or maybe a different picture appears, and I want auto it to go to (640, 502) [because that is where it is on screen] and left click once

and then, if these pictures do not appear, i want auto it to continue the main command

I have the main part downpat but Im thinking the conditions are screwing with my head!

Link to comment
Share on other sites

it is quite possible to do what you want... there are several methods for finding "pictures" on the screen. (One that I wrote myself... although its probably not the best out there)

Try searching around for it.

As for your looping problem, you'd simply want to try something like this:

while 1
   ;main command
   $timer_start = timerinit()
   do
      ; look for pic
      sleep(10)
   until timerdiff($timer_start) > 20000 ; It will look for your pic for 20 seconds (20,000 ms) and then start your main command again.
wend
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...