Jump to content

How would I make the image search search only inside my GUI?


aa2zz6
 Share

Recommended Posts

How would I make the image search search only in my GUI? The GUI class name: AutoIt v3 GUI.

#include <ImageSearch.au3>
#include <GDIPlus.au3>

test()

Func test()

    #include <ImageSearch.au3>
    Local $aIcons[1], $i

    $aIcons[0] = @ScriptDir & "\pics\image1.png"

    $x = 0
    $y = 0

    For $i = 0 To UBound($aIcons) - 1
        $result = _ImageSearch($aIcons[$i], 1, $x, $y, 20, 0)
        If $result > 0 Then
            MouseClick($MOUSE_CLICK_PRIMARY, $x, $y, 1)
            ExitLoop
            Sleep(1000)
        EndIf
    Next

EndFunc   ;==>test

 

Link to comment
Share on other sites

#include <ImageSearch.au3>
#include <GDIPlus.au3>

test()

Func test()

    #include <ImageSearch.au3>
    Local $aIcons[1], $i, $x, $y

    $aIcons[0] = @ScriptDir & "\pics\image1.png"



    For $i = 0 To UBound($aIcons) - 1
        $p = WinGetPos("AutoIt v3 GUI")
        $result = _ImageSearchArea($aIcons[$i],1,$p[0],$p[1],$p[0]+$p[2],$p[1]+$p[3], $x, $y, 20)
        If $result > 0 Then
            MouseClick($MOUSE_CLICK_PRIMARY, $x, $y, 1)
            ExitLoop
            Sleep(1000)
        EndIf
    Next

EndFunc   ;==>test

 

Edited by Tyzing
Link to comment
Share on other sites

#include <ImageSearch.au3>
#include <GDIPlus.au3>

test()

Func test()

    #include <ImageSearch.au3>
    Local $aIcons[1], $i, $x, $y

    $aIcons[0] = @ScriptDir & "\pics\image1.png"



    For $i = 0 To UBound($aIcons) - 1
        $p = WinGetPos("[CLASS:AutoIt v3 GUI]")
        $result = _ImageSearchArea($aIcons[$i],1,$p[0],$p[1],$p[0]+$p[2],$p[1]+$p[3], $x, $y, 20)
        If $result > 0 Then
            MouseClick($MOUSE_CLICK_PRIMARY, $x, $y, 1)
            ExitLoop
            Sleep(1000)
        EndIf
    Next

EndFunc   ;==>test

Use this

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...