Sign in to follow this  
Followers 0
Sedoc94

Image Search Library

6 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

i have tried this and cant get it to work all i get is this error

Autoit3.exe has encountered a problem and needs to close blah blah

no idea why this is im on xp pro btw

any ideas anyone?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

we are not soothsayers. Post some code.

EDIT:... And upload an image.

Edited by monoscout999

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

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  
Followers 0