Jump to content
Sign in to follow this  

Auto It Not Finding Image with Image Search

Recommended Posts

I'm trying to use autoit to find a certain logo. I print screened, cropped it, and saved it as a bmp in the script folder. I'm on a 64 bit system, but downloaded the 32 bit package from this post: '?do=embed' frameborder='0' data-embedContent>>

I put the DLL and ImageSearch script into the same file as my .bmp file and test script.

I basically took the test script from that post

#include "ImageSearch.au3"

HotKeySet("p", "checkForImage")

global $y = 0, $x = 0

Func checkForImage()

   Local $search = _ImageSearch('checkImage.bmp', 0, $x, $y, 0,100)
   If $search = 1 Then
      MouseMove($x, $y, 10)

while 1

I run it, press 'p', and nothing happens. It goes into the checkForImage function, but for some reason just doesn't find the image. Not sure what i'm doing wrong. It's definitely on the screen, and I even increased tolerance in case that was an issue. 

What am I doing wrong?? Thanks!

Share this post

Link to post
Share on other sites

Hi and welcome to the forums!

There are literally 1000+ things can cause your script to not fullfill its desired task. I haven't used _ImageSearch before in my job, but will definetly play around with it once I have the free time to develope what I want :) 

When you press P, its not true taht "nothing happens", as you said your script goes in to the intended function, so your hotkeyset achieved what it had to (yeeeah!) ! from here on (since we don't know whats the problem, as long as I glance on the code, I see no problem, that again means next to nothing :) , but it should work fine I think) we may need to use some debugging tools. Opt("TrayIconDebug", 1) (default is 0) will create a little icon in your tray, where you can stop your script and also check where it is in its execution if you hower your mouse over it. You can also put some MsgBoxes to certain points to see if the script goes to that line or not. #AutoIt3Wrapper_Run_Debug_Mode = Y and

#AutoIt3Wrapper_Run_Debug = On can prove to be even more helpful, I'm not really good at the technical denomination, but it basicly write the execution of the script in the console, soo you can follow up whats happened.
Do you hear a beep when the picture is there and you hit P? (I guess that Beep sound is there for that reason). Since as I said things looks okey to me, I would guess, that you may looking for a moving picture (a gif?)? Because it would be hard to _ImageSearch because the .bmp would only return + if it finds the exact same image, as I read the tolarence only expand the possible colors (sorry if I'm wrong, but prove me wrong, and I may learn something :) ).
I'm not sure what else could be a problem, as I'm not familiar with the UDF, but tell us the returns of the debugging and we may be a bit more well equipped to solve this :)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...