Zag8888 Posted April 16, 2019 Share Posted April 16, 2019 Hi, I want to check every 10 seconds (using _ImageSearch) If the image is found. I hope someone can help me, thanks! #include <_ImageSearch.au3> #include <_ImageSearch_Debug.au3> $Image = _ImageSearch("Seach_2.bmp",10,True) While $Image[0] <> 1 ;The script just sleep, instead of checking every 10 seconds. Sleep(10000) WEnd Link to comment Share on other sites More sharing options...
BrewManNH Posted April 16, 2019 Share Posted April 16, 2019 Your imagesearch needs to be inside the loop, it only checks it once before going into the loop as written. Zag8888 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Zag8888 Posted April 17, 2019 Author Share Posted April 17, 2019 12 hours ago, BrewManNH said: Your imagesearch needs to be inside the loop, it only checks it once before going into the loop as written. Now it works! But the while loop will not end also if the image is found... Link to comment Share on other sites More sharing options...
water Posted April 17, 2019 Share Posted April 17, 2019 You know that every functions returns some indication telling you that the function endet successfully or that an error occurred? Depending on this indication you have to check for the image again or leave the loop. The rest is pure AutoIt My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Bert Posted April 17, 2019 Share Posted April 17, 2019 Why do you need to search for an image every 10 seconds? why not just hook into the control and get it's state? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Zag8888 Posted April 17, 2019 Author Share Posted April 17, 2019 1 hour ago, Bert said: Why do you need to search for an image every 10 seconds? why not just hook into the control and get it's state? Can you please explain how can I do this? Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted April 17, 2019 Developers Share Posted April 17, 2019 3 hours ago, Zag8888 said: Can you please explain how can I do this? Thanks Only if you are willing to share what you are doing exactly or else it is guess work. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zag8888 Posted April 17, 2019 Author Share Posted April 17, 2019 12 minutes ago, Jos said: Only if you are willing to share what you are doing exactly or else it is guess work. Jos That's the full code, I just want to try this function, because for me it never worked. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 17, 2019 Developers Share Posted April 17, 2019 Sure...but WHAT do you want to use this for so WE can try to help you... Else please don't waste our time and forum space. Clear enough for you this time? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zag8888 Posted April 17, 2019 Author Share Posted April 17, 2019 21 minutes ago, Jos said: Sure...but WHAT do you want to use this for so WE can try to help you... Else please don't waste our time and forum space. Clear enough for you this time? Jos I made a photo, I just want the script click on this photo when its found, that's all. I just want to learn Autoit, I'm liking it a lot! Link to comment Share on other sites More sharing options...
El-Masry Posted April 18, 2019 Share Posted April 18, 2019 You are lucky that I have seen your topic ! ======= First of all, you shouldn't use the ordinary image search function...as it is not good because it requires that the image appears on the screen, so you can't do any other thing while the script is running ,so you need the ~:{:}{ImageSearchEX}{:}:~ function by it,you can search for the image in a specific window...and the function don't require that the image appears on the screen >> only it should appear on the window ,so this function run in the background ======= Image Search EX Topic : https://www.autoitscript.com/forum/topic/196542-image-search-inactive-window-but-not-minimized/ ======= note that : 1 : This function doesn't run on X64 bit ,so you have to make the script run on 32 bit by using : #AutoIt3Wrapper_UseX64=NO 2 : This function requires the window to be shown ,not minimized or hidden. ,so if you want to hide the window : just move it to (-X , -Y) Position that is out of the screen ====== Eventually : Here is the code you need : #NoTrayIcon #AutoIt3Wrapper_UseX64=NO #include <imageSearchEX.au3> Global $imageSearchEX = imageSearchEX Global $_Check_Image = _Check_Image $Your_Window = "";your window $Your_Control = "";your Control $Your_Image = "";your Image While 1 $Coords = $_Check_Image($Your_Window,$Your_Control,$Your_Image) If $Coords <> 0 Then ;Do Something ExitLoop EndIf Sleep(10000) ;Sleep 10 Seconds WEnd Func _Check_Image($Window, $Control, $Image) $Hwnd = WinGetHandle($Window) $Control_Pos = ControlGetPos($Hwnd,$Control) $Coords = $imageSearchEX($Hwnd,$Image) Return $Coords EndFunc Zag8888 and churaproth 2 Link to comment Share on other sites More sharing options...
El-Masry Posted April 18, 2019 Share Posted April 18, 2019 Sorry,the code is not complete ..i didn't revise it 🤒 Also, there is no (Edit) Button 🙄 Here it is : #NoTrayIcon #AutoIt3Wrapper_UseX64=NO #include <imageSearchEX.au3> Global $imageSearchEX = imageSearchEX Global $_Check_Image = _Check_Image $Your_Window = "";your window $Your_Control = "";your Control $Your_Image = "";your Image While 1 $Coords = $_Check_Image($Your_Window,$Your_Control,$Your_Image) If $Coords <> 0 Then ;Do Something ExitLoop EndIf Sleep(10000) ;Sleep 10 Seconds WEnd Func _Check_Image($Window, $Control, $Image) $Hwnd = WinGetHandle($Window) $Control_Pos = ControlGetPos($Hwnd,$Control) $Coords = $imageSearchEX($Hwnd,$Image) $Result = $Coords If $Coords <> 0 Then Local $Image_Pos[] = [ $Coords[0] - $Control_Pos[0], $Coords[1] - $Control_Pos[1] ] $Result = $Image_Pos EndIf Return $Result EndFunc Zag8888 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted April 18, 2019 Developers Share Posted April 18, 2019 Hey @El-Masry, or should I say @ibrahem... and what an entrance 😟 10 hours ago, El-Masry said: You are lucky that I have seen your topic ! Jos yutijang 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
El-Masry Posted April 18, 2019 Share Posted April 18, 2019 5 hours ago, Jos said: Hey @El-Masry, or should I say @ibrahem... and what an entrance 😟 Jos I am just helping him, which is not against forum rules!. Zag8888 1 Link to comment Share on other sites More sharing options...
El-Masry Posted April 18, 2019 Share Posted April 18, 2019 Also, I have suffered from his problem.. And that took many time and effort of search.. Because no one helped me 😒💔 Zag8888 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted April 18, 2019 Developers Share Posted April 18, 2019 Ah ... the victim role. I am not shedding any tears as you know that you were not banned because nobody helped you. You will be on a very short leece so 1 single "mistake" will get you banned. Jos FrancescoDiMuro 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
El-Masry Posted April 18, 2019 Share Posted April 18, 2019 (edited) On 4/18/2019 at 2:35 PM, Jos said: You will be on a very short leece so 1 single "mistake" will get you banned. Thanks for this 2nd chance 🙂. Also, I have studied the forum rules well. 😀 Edited April 20, 2019 by El-Masry Zag8888 1 Link to comment Share on other sites More sharing options...
Zag8888 Posted April 20, 2019 Author Share Posted April 20, 2019 On 4/18/2019 at 11:44 PM, El-Masry said: Thanks for this 2nd chance 🙂. Also, I have studied the forum rules well. 😀 Thanks a lot for your help! I'm sorry if I didn't replied, but I was sick 🤒 El-Masry 1 Link to comment Share on other sites More sharing options...
El-Masry Posted April 22, 2019 Share Posted April 22, 2019 @Zag8888 , Have a look at this Link to comment Share on other sites More sharing options...
El-Masry Posted April 22, 2019 Share Posted April 22, 2019 This function is much better 👌😎: https://www.autoitscript.com/autoit3/docs/functions/AdlibRegister.htm 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