YuChan Posted January 27, 2021 Share Posted January 27, 2021 Hello all, I have this code : HotKeySet("{Esc}", "_Exit") ; Press ESC for exit Func _Exit() Exit 0 EndFunc ;==>_Exit Global Const $Ask_On_Found = 1 Global Const $Mouse_Move_On_Found = 1 Global Const $Mouse_Click_On_Found = 0 Global $_Image_1 = @ScriptDir & "\test.png" ; First, use this function to create a file bmp, maybe a desktop icon for example') MsgBox(64 + 262144, 'ImageSearch', 'At first, create a file bmp,' & @CRLF & 'photos that will search on the screen!') ConsoleWrite("! Search for images: " & $_Image_1 & @CRLF & '! Searching on the screen ...' & @CRLF) While 1 ToolTip('(Press ESC for EXIT) Searching ...', 1, 1) Local $return = _ImageSearch($_Image_1) If $return[0] = 1 Then ConsoleWrite('- Image found:' & " X=" & $return[1] & " Y=" & $return[2] & @CRLF) If $Mouse_Move_On_Found Then MouseMove($return[1], $return[2]) If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2]) ToolTip('(Press ESC for EXIT) Image found:' & " X=" & $return[1] & " Y=" & $return[2], 1, 1) If $Ask_On_Found Then Local $ask = MsgBox(6 + 262144, 'Success', 'Image found:' & " X=" & $return[1] & " Y=" & $return[2]) If $ask = 2 Or $ask = 3 Or $ask = 5 Or $ask = 7 Then Exit ;No, Abort, Cancel, and Ignore If $ask = 10 Then _ImageSearch_Create_BMP($_Image_1) ; Continue ;Try Again EndIf EndIf Sleep(200) WEnd My image text.png is one png and can change backround. How to found my picture.test.bmp Thank you Link to comment Share on other sites More sharing options...
YuChan Posted January 27, 2021 Author Share Posted January 27, 2021 I have show, my tips is Tolerance. But how it's work Link to comment Share on other sites More sharing options...
Somerset Posted January 28, 2021 Share Posted January 28, 2021 0 to 255 is the answer. FrancescoDiMuro 1 Link to comment Share on other sites More sharing options...
Musashi Posted January 28, 2021 Share Posted January 28, 2021 On 1/27/2021 at 3:26 AM, YuChan said: How to found my picture. How can you expect an answer, when essential parts of your script are missing ? "... (19,43) : error: _ImageSearch(): undefined function. "... (28,64) : error: _ImageSearch_Create_BMP(): undefined function. Considering your previous posts (many were closed or showed little self-initiative), only a few users will probably bother to help you. That is especially the case, when the sensitive topic of 'imagesearch' comes into play. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
YuChan Posted January 28, 2021 Author Share Posted January 28, 2021 (edited) Hello, this code is old. I have join file with all script test.au3 ImageSearch2015.au3 Edited January 29, 2021 by YuChan Link to comment Share on other sites More sharing options...
YuChan Posted February 6, 2021 Author Share Posted February 6, 2021 (edited) Hello, Im searching since 2 week and i not found how to make. I have this : Func _ImageSearch($findImage,$resultPosition, ByRef $x, ByRef $y,$tolerance=255, $HBMP=0) return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP) EndFunc #include "ImageSearch2015.au3" #include <GDIPlus.au3> $fileA = "test.png" _GDIPlus_Startup() $hImageA = _GDIPlus_ImageLoadFromFile($fileA) $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) If $result > 0 Then MsgBox($MB_SYSTEMMODAL, "Test", "Color was found", 1) EndIf Func idle() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE exit EndSwitch sleep(40) WEnd EndFunc Please how to make for srearch one picture with one for who go test 1 to 255 tolerance ? My pictures is one png who is tranparent and can change background THX Edited February 6, 2021 by YuChan ADD IMAGE FILE Link to comment Share on other sites More sharing options...
junkew Posted February 11, 2021 Share Posted February 11, 2021 (edited) Probably read wiki FAQ 38 -snip- Edited February 11, 2021 by Jos Sorry I am normally against removing info from posts, but I have an issue with this member so don't want to have any other conversations open with him. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Musashi Posted February 11, 2021 Share Posted February 11, 2021 @junkew : Just a friendly note in case you missed the other threads by @YuChan . Take a look at : https://www.autoitscript.com/forum/topic/205094-one-gui-who-follow-mouse/?do=findComment&comment=1474709 https://www.autoitscript.com/forum/topic/205096-mouse-position/?do=reportComment&comment=1474661 You're probably wasting your precious time to a person, who doesn't deserve it . FrancescoDiMuro 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Recommended Posts