Jump to content

Image Search Library


Recommended Posts

Hello,

So I am new to AutoIt and just practising and so far I like it very much and pretty easy to do.

I have this for the normal pic: Posted Image

Do
    $result = _ImageSearch("example.png", 1, $x, $y, 10)
    If $result = 1 Then
        MsgBox(0, "", "IMAGE FOUND")
    EndIf
Until $result == 1

This works fine..

And I have this for the pic with some color added on it which should be seen as transparent by the ImageSearch function: Posted Image

The color on there which should be seen as transparent is 0xF700FF

so I did:

Do
    $result = _ImageSearch("example2.png", 1, $x, $y, 10, 0xF700FF)
    If $result = 1 Then
        MsgBox(0, "", "IMAGE FOUND")
    EndIf
Until $result == 1

But for this one it somehow doesnt find the image while the image is showing on the screen :[

Have I done something wrong?

Thank you very much for your help! :D

Link to comment
Share on other sites

you are using the last parameter wrong. its supposed to be a number from 0 - 255 and used when the color of the image your looking for would vary in shades. using the images on this browser, i used this code and got the correct results

#include <ImageSearch.au3>

$x1=0
$y1=0

WinActivate("Image Search Library - AutoIt Forums - Google Chrome", "")
WinWaitActive("Image Search Library - AutoIt Forums - Google Chrome", "")

$result = _ImageSearch(@DesktopDir & "\sq.bmp",1,$x1,$y1,0)
    if $result=1 Then
        MsgBox(0, "", "found")
    Else
        MsgBox(0, "", "not found")
        Exit
    EndIf

And one more suggestion. I find that using BMP's get correct results more often...could just be me though :-p

Link to comment
Share on other sites

  • 2 weeks later...

This is frustrating i have tried various scripts and both the large and small dll file

i either get the error i mentioned before or the script wont even start

i cant even get it to recognise the trash bin on my desktop can anyone give me any help?

Link to comment
Share on other sites

au.bmp

we are not soothsayers. Post some code.

EDIT:... And upload an image.

haha ok

#include <ImageSearch.au3>

$x1 = 0

$y1 = 0

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$result = _ImageSearch("au.bmp",1,$x1, $y1,0) ;au.bmp is small bmp of trashcan

If $result = 1 Then

mouseclick("left",$x1, $y1) ;click on trashcan

sleep(10000)

Else

EndIf

EndFunc

thats my code and here is my pic of middle of trashcan

Edited by madjack
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...