Does anybody have _imagesearch working?

06/14/2014 16:26 seanbrockest#1
I've got a pretty decent bot planned and mostly written, but it hinges on _imagesearch or even better _imagesearcharea working. Unfortunately the copy of _imagesearch i have doesn't seem to work with the current version of AutoIt.

To check this, I finally made a 10x10 bmp of white pixels and tried to find it in a white desktop. It failed every time. This makes me pretty sure it's not my code that's failing, but the _imagesearch.

Does anybody have a version of _imagesearch that they know for sure works with the current version of AutoIt? _imagesearch doens't seem to have an official repository or site. I found a thread on the official autoit forums for it, but the links are dead, and the autoit forum community wont help me at all. They dont seem to like _imagesearch, because "it's only used for botting", which is now against their forum rules.

I'm more than willing to post my code/bot once it works. Not many people play the game i'm writing it for, but who knows, maybe it will help someone.
06/14/2014 17:04 alpines#2
Isolate your problem to a new script with the 10x10 white image.
Probably it's just a small error. Otherwise you can try to use PixelPattern which is slower but finds your image.
06/14/2014 18:19 seanbrockest#3
Quote:
Originally Posted by alpines View Post
Isolate your problem to a new script with the 10x10 white image.
Probably it's just a small error. Otherwise you can try to use PixelPattern which is slower but finds your image.

I have :(

Code:
#include <ImageSearch.au3>

Global $running = 0, $testx=0, $testy=0, $whitesquare=0

HotKeySet("{ESC}", "Terminate")
HotKeySet("{SPACE}", "togglerun")

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func togglerun()
    If $running = 0 Then
        $running = 1
        TrayTip("", "Program Started", 3)
    ElseIf $running = 1 Then
        $running = 0
        TrayTip("", "Program Paused", 3)
EndIf


    EndFunc   ;==>togglerun

While 1 = 1

While $running = 0
    sleep(500)
WEnd

while $running = 1
    local $whitesquare=0
    $whitesquare = _ImageSearch("white.bmp", 1, $testx,$testy,200)
    if $whitesquare = 1 Then
        TrayTip("", "Image Found!", 3)
    ElseIf $whitesquare = 0 Then
        TrayTip("", "FAILED", 3)
    EndIf
    $running=0

WEnd

WEnd
To test my code yourself, just make a little bmp with whatever color you have on your desktop, and call it white.bmp . It fails every time :(

If this code works for you, please send me your ImageSearch.au3 and ImageSearchDLL.dll

As far as your second suggestion, did you mean this?

[Only registered and activated users can see links. Click Here To Register...]

Thanks!
06/15/2014 19:42 alpines#4
Actually the script crashed on my computer. Probably I was just using the wrong DLL, I don't know.
There are several methods to find Pixels specified by patterns / images on your screen, try them all out.
06/16/2014 06:04 flumio#5
[Only registered and activated users can see links. Click Here To Register...]