ibrahem Posted November 14, 2018 Share Posted November 14, 2018 (edited) this is a UDF to make image search on inactive window, but not minimized. using it, you can seach for coords of an image so that you can use ControlClick to click on it in Background while you are watching a movie or doing something else on the screen. i am not who made this UDF . i only fixed some bugs on it : it wasn't able to run on 64 bit : so i added #AutoIt3Wrapper_UseX64=NO it looked for the top left of the image : so i made it find the height \ 2 and the width \ 2 of the image and add them to the Coords so the Coords will be at the middle of the image ... here is the UDF : imageSearchEX.au3 BmpSearch.au3 here is an example : #AutoIt3Wrapper_UseX64=NO ;because ImageSearchEX doesn't run on 64 bit #include <imageSearchEX.au3> $imageSearchEX = imageSearchEX ; this is to make it easy to write the name of the func ^_^ $Win = "..." ;the name or class of requested window $Image = "..." ;the path to the image you want to look for > it must be 24-bit Bitmap....and remember the more the image is small the faster you find it $_$.... ;you can use snipping tool .exe to capture it and use paint .exe to save it as 24-bit Bitmap $p= $imageSearchEX($Win,$Image) if $p=0 Then ; what to do if image was not exists MsgBox(0,"","Image Doesn't exist") EndIf _ArrayDisplay($p) ; you can delete this line >> as it only shows you the Coords of the image on the window ControlClick($Win,"leave it blank","the control you want to click","primary ...or the button you want to click","Number of clicks",$p[0],$p[1]) #cs ;If you want to test it on the screen using MouseClick or Mouse move ...etc $WinSize= WinGetPos("(Frozen) AutoIt v3 Window Info") MouseMove($p[0] + $WinSize[0],$p[1] + $WinSize[1],1) #ce and here are some functions to make it easy to use this UDF : #AutoIt3Wrapper_UseX64=NO #include <imageSearchEX.au3> Global $imageSearchEX = imageSearchEX Global $FAC = FindAndClick Global $WUA = WaitUntilAppear Global $WUATC = WaitUntilAppearThenClick Func FindAndClick($Window,$Image,$Control) ;~ This function is to find an image that is surely on the window when this function is called $coords = $imageSearchEX($Window,$Image) ControlClick($Window,"",$Control,"primary",1,$coords[0],$coords[1]) EndFunc Func WaitUntilAppear($Window,$Image,$Control) ;~ This function is to pause the script until an image is found on the window While 1 $coords = $imageSearchEX($Window,$Image) If Not $coords = 0 Then ExitLoop Sleep(50) WEnd EndFunc Func WaitUntilAppearThenClick($Window,$Image,$Control) ;~ This function is to pause the script until an image is found on the window then click on that image While 1 $coords = $imageSearchEX($Window,$Image) If Not $coords = 0 Then ControlClick($Window,"",$Control,"primary",1,$coords[0],$coords[1]) ExitLoop EndIf Sleep(50) WEnd EndFunc GAMERS - Asking for help with ANY kind of game automation is against the forum rules. DON'T DO IT. Sorry for bad English Edited November 16, 2018 by ibrahem deleteme_yes, totta_fadil and El-Masry 2 1 Link to comment Share on other sites More sharing options...
plainly Posted December 4, 2018 Share Posted December 4, 2018 your two functions waituntilappear... don't seem to work for me. the "while 1" function will end automatically as the statement for the array is false. I think this works better Do $Cords = imagesearchex($a,$b) $c = isarray($coords) sleep(50) until $c = 1 controlclick(.....) El-Masry 1 Link to comment Share on other sites More sharing options...
Swariwaza Posted September 4, 2019 Share Posted September 4, 2019 is there any tolarance parameter in this script? Link to comment Share on other sites More sharing options...
totta_fadil Posted October 8, 2019 Share Posted October 8, 2019 thank you for the code it worked, but how can I use it to search for 2 or 3 pictures so if it finds anyone of them clicks on it ? 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