Jump to content
Sign in to follow this  

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!

Share this post

Link to post
Share on other sites

ok after researching, I have learned this isnt possible

however pixel search is ;)

how do I ask auto it to do the main command, sleep for 20 seconds, then repeat the main command but while it is sleeping, to search for a colour and click it if found?

Share this post

Link to post
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()
      ; look for pic
   until timerdiff($timer_start) > 20000 ; It will look for your pic for 20 seconds (20,000 ms) and then start your main command again.

Share this post

Link to post
Share on other sites

The sleep and look code:

For $i=1 to 200 ;200*100=20000ms=20sec
;look for pixel code goes here

Trust me to make SkyNet with AutoIt...

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.