Jump to content
kangkeng

Image Search Library

Recommended Posts

Guess you are referring to the original post made in 2008 by somebody that hasn't been around since 2011? I rest my case .. ')

Jos

Lol. Well said, tho not helpful to the user you are replying to.

Download seems to be broken.

https://www.autoitscript.com/forum/topic/148005-imagesearch-usage-explanation/

Next time, try searching the AutoIt forums for "Image Search" and you will find what you need. If you cannot find what you need, google would be your next go-to.


 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites

Lol. Well said, tho not helpful to the user you are replying to.

There was no intent to be more helpful other than to trigger the person to show a little more effort by making a "smart remark". 

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

There was no intent to be more helpful other than to trigger the person to show a little more effort by making a "smart remark". 

Jos

Thus why I said well said. I agree with you; people need to do a little more research first before posting for help. Paying more attention to post dates or just in general would also help.

Edit: I just feel instead of patronizing the inexperienced, we should tell them the proper method for obtaining information.

Edited by BetaLeaf
added thoughts.

 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites

Edit: I just feel instead of patronizing the inexperienced, we should tell them the proper method for obtaining information.

Agree in general, but it wears off a little after being here for this long ...  sorry for that. ;)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

mashrino,

It is an known Au3Check problem - put a space between the comma and ByRef in each of those lines. Or run Tidy on every file involved.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

 

 

On 5/20/2016 at 4:02 PM, Melba23 said:

mashrino,

It is an known Au3Check problem - put a space between the comma and ByRef in each of those lines. Or run Tidy on every file involved.

M23

Thank you very much Melba. I am getting another error now. Could you please help me on this.

2016-05-23_10h24_32.png

2016-05-23_10h23_32.png

Share this post


Link to post
Share on other sites

Hi.

I found solution for the above.

Is it possible to click an image without moving the mouse. And could you please give me an sample code for waitforimagesearch function,

Thanks in advance. :)

Share this post


Link to post
Share on other sites
On 20/05/2016 at 7:24 PM, mashrino said:

Hi,

I am new to AutoIT. When I try to run the attached code (Imagesearch.au3) I am getting error. Please find the attachment and kindly provide me a solution.

 

Thanks in advance.

ImageSearchDemo.au3

2016-05-20_12h45_46.png

2016-05-20_12h46_06.png

 

Hi,

This is a symptom of running the application in the opposite bit architecture. For example, if you have the 32bit (x86) DLL, but are running the script as x64.

The original ImageSearchDLL.dll is accompanied by ImageSearch.au3.  I added the following to the top of this autoit script to ensure I don't get this issue:
 

#AutoIt3Wrapper_UseX64=n  ;; This forces this script to run NOT in x64 (as I use the 32bit), change to "Y" if u have x64 DLL.

If @AutoItX64 = 1 Then
    MsgBox(0, "", "Error: " & @CRLF & _
                  "You have Run/Compiled this as x64. " & @CRLF & _
                  "This uses a 32bit DLL. so you must Run/Compile the Script as x86")
    Exit
EndIf

Then in MY script which calls ImageSearch, I have added this to the top:

#AutoIt3Wrapper_UseX64=N ;; No = 32bit(x86) - we are using the 32bit img search library

As a side note, if you use "#RequireAdmin" (for ControlClicking certain windows), your ConsoleWrite("blah = " & $blah & @CRLF) wont display in scite when you run your script. If you locate the Scite EXE in program file and set it's compatibility mode to run as admin, then it will work again.

Share this post


Link to post
Share on other sites
On 11/18/2009 at 2:31 PM, Zedna said:

Here is original ImageSearch DLL with AU3 wrapper and also with C++ sources.

ImageSearch.zip

HI I downloaded the above zip file bt i m still getting error, even after placing imagesearchDLL.dll file in my c drive System32 location.

could u plss help. I am using 64 bit version of OS. Attaching the screenshot of the error msg. 

 

error.png

Share this post


Link to post
Share on other sites
1 hour ago, VandanaS said:

HI I downloaded the above zip file bt i m still getting error, even after placing imagesearchDLL.dll file in my c drive System32 location.

could u plss help. I am using 64 bit version of OS. Attaching the screenshot of the error msg. 

 

error.png

You do not put the dll in the system32 folder. It needs to be in the same directory imagesearch.au3 is in.


 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites
1 hour ago, BetaLeaf said:

You do not put the dll in the system32 folder. It needs to be in the same directory imagesearch.au3 is in.

Hi ,

Thanks for ur response.

Bt i have read on various websites on google , where it was mentioned that .dll files are needed to be kept in system Directory. I have tried running the .au3 file while placing .dll file in the same directory (Both the files I kept in "Include" folder of Autoit), bt still its not working. Its returning 0. Plss help , its really urgent and I am an absolute beginner with autoit.

Thanks in Advance :)

 

Share this post


Link to post
Share on other sites
36 minutes ago, VandanaS said:

Hi ,

Thanks for ur response.

Bt i have read on various websites on google , where it was mentioned that .dll files are needed to be kept in system Directory. I have tried running the .au3 file while placing .dll file in the same directory (Both the files I kept in "Include" folder of Autoit), bt still its not working. Its returning 0. Plss help , its really urgent and I am an absolute beginner with autoit.

Thanks in Advance :)

 

Here, you can use my copy. I don't know where you got yours but some of the sources on the auto it forums dont work for whatever reason. 

ImageSearch.zip

Edited by BetaLeaf
I forgot I can just upload via attachment; link removed.

 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites
On 12/1/2016 at 5:47 PM, Chillaz said:

 

Hi,

This is a symptom of running the application in the opposite bit architecture. For example, if you have the 32bit (x86) DLL, but are running the script as x64.

The original ImageSearchDLL.dll is accompanied by ImageSearch.au3.  I added the following to the top of this autoit script to ensure I don't get this issue:
 

#AutoIt3Wrapper_UseX64=n  ;; This forces this script to run NOT in x64 (as I use the 32bit), change to "Y" if u have x64 DLL.

If @AutoItX64 = 1 Then
    MsgBox(0, "", "Error: " & @CRLF & _
                  "You have Run/Compiled this as x64. " & @CRLF & _
                  "This uses a 32bit DLL. so you must Run/Compile the Script as x86")
    Exit
EndIf

 

This is incorrect. I'm not sure why the creator shipped it out without a seperator. I'm guessing an older version of autoit did not require it. What I do know is architecture has nothing to do with it as this error still happens no matter what architecture you run the script under. Just add the seperator (space) and save it and you should be good.

Also, if you want to run 64 bit image search, then the included dll from auto it forums will not work and will always return 0. This is because the dll was not compiled for 64 bit architecture. See the link above, it contains both 32 and 64 bit dlls and the associated udf.


 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites
1 hour ago, BetaLeaf said:

Here, you can use my copy. I don't know where you got yours but some of the sources on the auto it forums dont work for whatever reason. 

ImageSearch.zip

Hi,

Thanks a lot.

But currently, i am in my organisation network where i cannot download the file. Could u plss paste the content of your ImageSearch.au3 file so that i can check my file. Also , i m placing ImageSearch.au3 file, ImageSearchDLL.dll file and .bmp file in "Include" folder of autoit. kindly correct me if i am doing anything wrong.

Share this post


Link to post
Share on other sites
#include-once
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Description:    Functions that assist with Image Search
;                 Require that the ImageSearchDLL.dll be loadable
;
; ------------------------------------------------------------------------------

;===============================================================================
;
; Description:      Find the position of an image on the desktop
; Syntax:           _ImageSearchArea, _ImageSearch
; Parameter(s):
;                   $findImage - the image file location or HBitmap to locate on the
;                                   desktop or in the Specified HBitmap
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
;                   $HBMP - optional hbitmap to search in. sending 0 will search the desktop.
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
;       a desktop region to search
;
;===============================================================================
Func _ImageSearch($findImage,$resultPosition, ByRef $x, ByRef $y,$tolerance, $HBMP=0)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
EndFunc
Func _ImageSearch64($findImage,$resultPosition, ByRef $x, ByRef $y,$tolerance, $HBMP=0)
   return _ImageSearchArea64($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom, ByRef $x, ByRef $y, $tolerance,$HBMP=0)
    ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)

    If IsString($findImage) Then
        if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
        If $HBMP = 0 Then
            $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
        Else
            $result = DllCall("ImageSearchDLL.dll","str","ImageSearchEx","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
        EndIf
    Else
        $result = DllCall("ImageSearchDLL.dll","str","ImageSearchExt","int",$x1,"int",$y1,"int",$right,"int",$bottom, "int",$tolerance, "ptr",$findImage,"ptr",$HBMP)
    EndIf

    ; If error exit
    if IsArray($result) Then;heres the workaround..
    if $result[0]="0" then return 0
    Else
        if $result="0" then return 0
        EndIf

    ; Otherwise get the x,y location of the match and the size of the image to
    ; compute the centre of search
    $array = StringSplit($result[0],"|")

   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
Func _ImageSearchArea64($findImage,$resultPosition,$x1,$y1,$right,$bottom, ByRef $x, ByRef $y, $tolerance,$HBMP=0)
    ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)

    If IsString($findImage) Then
        if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
        If $HBMP = 0 Then
            $result = DllCall("ImageSearchDLL64.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
        Else
            $result = DllCall("ImageSearchDLL64.dll","str","ImageSearchEx","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
        EndIf
    Else
        $result = DllCall("ImageSearchDLL64.dll","str","ImageSearchExt","int",$x1,"int",$y1,"int",$right,"int",$bottom, "int",$tolerance, "ptr",$findImage,"ptr",$HBMP)
    EndIf

    ; If error exit
    if IsArray($result) Then;heres the workaround..
    if $result[0]="0" then return 0
    Else
        if $result="0" then return 0
        EndIf

    ; Otherwise get the x,y location of the match and the size of the image to
    ; compute the centre of search
    $array = StringSplit($result[0],"|")

   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
;===============================================================================
;
; Description:      Wait for a specified number of seconds for an image to appear
;
; Syntax:           _WaitForImageSearch, _WaitForImagesSearch
; Parameter(s):
;                   $waitSecs  - seconds to try and find the image
;                   $findImage - the image to locate on the desktop
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
;
;
;===============================================================================
Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        sleep(100)
        $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance,$HBMP)
        if $result > 0 Then
            return 1
        EndIf
    WEnd
    return 0
EndFunc
Func _WaitForImageSearch64($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        sleep(100)
        $result=_ImageSearch64($findImage,$resultPosition,$x, $y,$tolerance,$HBMP)
        if $result > 0 Then
            return 1
        EndIf
    WEnd
    return 0
EndFunc

;===============================================================================
;
; Description:      Wait for a specified number of seconds for any of a set of
;                   images to appear
;
; Syntax:           _WaitForImagesSearch
; Parameter(s):
;                   $waitSecs  - seconds to try and find the image
;                   $findImage - the ARRAY of images to locate on the desktop
;                              - ARRAY[0] is set to the number of images to loop through
;                                ARRAY[1] is the first image
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns the index of the successful find
;                   On Failure - Returns 0
;
;
;===============================================================================
Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        for $i = 1 to $findImage[0]
            sleep(100)
            $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP)
            if $result > 0 Then
                return $i
            EndIf
        Next
    WEnd
    return 0
EndFunc
Func _WaitForImagesSearch64($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        for $i = 1 to $findImage[0]
            sleep(100)
            $result=_ImageSearch64($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP)
            if $result > 0 Then
                return $i
            EndIf
        Next
    WEnd
    return 0
EndFunc

Place the dll in the SAME directory as this script, else it will return error 0. 

I'm heading to bed for now, if you need more help, then please wait until I wake up or maybe someone will be kind enough to help you further while im asleep.

Best of luck.


 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites
2 minutes ago, BetaLeaf said:
#include-once
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Description:    Functions that assist with Image Search
;                 Require that the ImageSearchDLL.dll be loadable
;
; ------------------------------------------------------------------------------

;===============================================================================
;
; Description:      Find the position of an image on the desktop
; Syntax:           _ImageSearchArea, _ImageSearch
; Parameter(s):
;                   $findImage - the image file location or HBitmap to locate on the
;                                   desktop or in the Specified HBitmap
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
;                   $HBMP - optional hbitmap to search in. sending 0 will search the desktop.
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
;       a desktop region to search
;
;===============================================================================
Func _ImageSearch($findImage,$resultPosition, ByRef $x, ByRef $y,$tolerance, $HBMP=0)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
EndFunc
Func _ImageSearch64($findImage,$resultPosition, ByRef $x, ByRef $y,$tolerance, $HBMP=0)
   return _ImageSearchArea64($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom, ByRef $x, ByRef $y, $tolerance,$HBMP=0)
    ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)

    If IsString($findImage) Then
        if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
        If $HBMP = 0 Then
            $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
        Else
            $result = DllCall("ImageSearchDLL.dll","str","ImageSearchEx","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
        EndIf
    Else
        $result = DllCall("ImageSearchDLL.dll","str","ImageSearchExt","int",$x1,"int",$y1,"int",$right,"int",$bottom, "int",$tolerance, "ptr",$findImage,"ptr",$HBMP)
    EndIf

    ; If error exit
    if IsArray($result) Then;heres the workaround..
    if $result[0]="0" then return 0
    Else
        if $result="0" then return 0
        EndIf

    ; Otherwise get the x,y location of the match and the size of the image to
    ; compute the centre of search
    $array = StringSplit($result[0],"|")

   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
Func _ImageSearchArea64($findImage,$resultPosition,$x1,$y1,$right,$bottom, ByRef $x, ByRef $y, $tolerance,$HBMP=0)
    ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)

    If IsString($findImage) Then
        if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
        If $HBMP = 0 Then
            $result = DllCall("ImageSearchDLL64.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
        Else
            $result = DllCall("ImageSearchDLL64.dll","str","ImageSearchEx","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
        EndIf
    Else
        $result = DllCall("ImageSearchDLL64.dll","str","ImageSearchExt","int",$x1,"int",$y1,"int",$right,"int",$bottom, "int",$tolerance, "ptr",$findImage,"ptr",$HBMP)
    EndIf

    ; If error exit
    if IsArray($result) Then;heres the workaround..
    if $result[0]="0" then return 0
    Else
        if $result="0" then return 0
        EndIf

    ; Otherwise get the x,y location of the match and the size of the image to
    ; compute the centre of search
    $array = StringSplit($result[0],"|")

   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
;===============================================================================
;
; Description:      Wait for a specified number of seconds for an image to appear
;
; Syntax:           _WaitForImageSearch, _WaitForImagesSearch
; Parameter(s):
;                   $waitSecs  - seconds to try and find the image
;                   $findImage - the image to locate on the desktop
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
;
;
;===============================================================================
Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        sleep(100)
        $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance,$HBMP)
        if $result > 0 Then
            return 1
        EndIf
    WEnd
    return 0
EndFunc
Func _WaitForImageSearch64($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        sleep(100)
        $result=_ImageSearch64($findImage,$resultPosition,$x, $y,$tolerance,$HBMP)
        if $result > 0 Then
            return 1
        EndIf
    WEnd
    return 0
EndFunc

;===============================================================================
;
; Description:      Wait for a specified number of seconds for any of a set of
;                   images to appear
;
; Syntax:           _WaitForImagesSearch
; Parameter(s):
;                   $waitSecs  - seconds to try and find the image
;                   $findImage - the ARRAY of images to locate on the desktop
;                              - ARRAY[0] is set to the number of images to loop through
;                                ARRAY[1] is the first image
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
;
; Return Value(s):  On Success - Returns the index of the successful find
;                   On Failure - Returns 0
;
;
;===============================================================================
Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        for $i = 1 to $findImage[0]
            sleep(100)
            $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP)
            if $result > 0 Then
                return $i
            EndIf
        Next
    WEnd
    return 0
EndFunc
Func _WaitForImagesSearch64($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
        for $i = 1 to $findImage[0]
            sleep(100)
            $result=_ImageSearch64($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP)
            if $result > 0 Then
                return $i
            EndIf
        Next
    WEnd
    return 0
EndFunc

Place the dll in the SAME directory as this script, else it will return error 0. 

I'm heading to bed for now, if you need more help, then please wait until I wake up or maybe someone will be kind enough to help you further while im asleep.

Best of luck.

yeah sure. Thanks a lot. :):)

 

 

Share this post


Link to post
Share on other sites
11 hours ago, BetaLeaf said:

Good Morning. Did everything work out?

HI,

Good evening,
i placed all the files (ImageSearchDLL.dll and MyScriptFile.au3) in my current directory and ImageSearch.au3 in Include folder of Autoit. but stil it is returning 0. I am not getting what I am doing wrong. The script i am  trying in hardly 5 lines of code. Plss help.
Also, plss let me know if u working in EST timing

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...