aa2zz6 Posted October 15, 2015 Share Posted October 15, 2015 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 More sharing options...
Tyzing Posted October 16, 2015 Share Posted October 16, 2015 (edited) #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 October 16, 2015 by Tyzing Link to comment Share on other sites More sharing options...
aa2zz6 Posted October 16, 2015 Author Share Posted October 16, 2015 I tried using the Local $aPos WinGetPos("classname=AutoIt v3 GUI") but the script didn't search inside the GUI, but rather it's still searching outside the GUI. Link to comment Share on other sites More sharing options...
Tyzing Posted October 16, 2015 Share Posted October 16, 2015 #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 ;==>testUse this Link to comment Share on other sites More sharing options...
aa2zz6 Posted October 17, 2015 Author Share Posted October 17, 2015 The process is unable to search only inside the GUI. I tried it a few different examples from the Help file but it didn't work. Link to comment Share on other sites More sharing options...
AutoBert Posted October 17, 2015 Share Posted October 17, 2015 ImageSearch searches in the whole DeskTop, but have you ever looked in the Imagesearch.au3?ImageSearchArea is what you're looking for, it's the working function called by Imagesearch with Params for the whole Desktop. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now