Roswiitha Posted August 29, 2022 Posted August 29, 2022 Hello there, I am currently using ImageSearch UDF Version 2021.8.30.1, AutoIt 3.3.16.0 on a Windows 11 machine. With the code shown below, I am able to move my mouse to the picture I search "picture.bmp" without a problem. If I start the script again with no changes in the script, it will not find the same picture again until, I restart the PC or re open the window with the picture in it. I want to search the picture x times and sometimes twice in a row. I thought about a cache problem, but didn't found any topics about that. Any ideas? I am using AutoIt not for the first time but I am still a beginner, go easy on me 🙌 Local $_Image_1 = @ScriptDir & "\images\picture.bmp" Local $return = _ImageSearch($_Image_1) If $return[0] = 1 Then $return[0] = 0 MouseMove($return[1], $return[2]) EndIf
Zedna Posted August 29, 2022 Posted August 29, 2022 Probably picture slightly changes (just little or only some pixels) after Mouse hover (over image) or after getting focus. Resources UDF ResourcesEx UDF AutoIt Forum Search
Roswiitha Posted August 29, 2022 Author Posted August 29, 2022 @Zedna Thanks for the fast reply. I checked it again, the picture doesn't change after searching it. The mouse is also not in the search area. I guarantee you, it doesn't change.
junkew Posted August 29, 2022 Posted August 29, 2022 How and when is the picture.bmp created? Did you do a pixel compare if its based on screenshots from different pointe in time? FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Zedna Posted August 29, 2022 Posted August 29, 2022 Try to use PixelChecksum() before/after your ImageSearch/MouseMove to check if target (pixels) area really doesn't change. Resources UDF ResourcesEx UDF AutoIt Forum Search
Roswiitha Posted August 30, 2022 Author Posted August 30, 2022 14 hours ago, junkew said: How and when is the picture.bmp created? Did you do a pixel compare if its based on screenshots from different pointe in time? The picture.bmp does always exist. I took a screenshot and saved the file as .bmp. The picture.bmp is not created with the script. I did a pixel compare after it is found, the pixel does not change.
junkew Posted August 30, 2022 Posted August 30, 2022 Do a mousemove 1,1 or 0,0 before you search. Most likely your screen is changing after a mousemove. You are searching the screen so any pixelchange in either image2search or imagesearchingin will give a mismatch. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Zedna Posted August 30, 2022 Posted August 30, 2022 Try to use $tolerance parameter (increase its value from 0) in _ImageSearch(). Resources UDF ResourcesEx UDF AutoIt Forum Search
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