mortog Posted June 20, 2014 Share Posted June 20, 2014 (edited) Hey everyone, I'm trying to create a script that will eventually search through a bunch of images, but I can't even get the basics to work. Could anyone tell me what I'm doing wrong? Below is the code and the steps I've taken trying to solve the problem: #Include <ImageSearch.au3> HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc global $y = 0, $x = 0 While 1 Sleep (2000) $search = _ImageSearch("test.jpeg", 1, $x, $y, 20) Sleep (2000) If $search = 1 Then MsgBox (0, "" , "succes!") Else msgbox (0, "", $search) EndIf WEnd - the file test.jpeg is just a screenshot of the section that says: "global $y = 0, $x = 0". - I've tried the 32 and 64 bit versions of imagesearch - the DLL file is in the windowssystem32 folder and the imagesearch file in the autoitinclude folder - I've also tried the example from >this site but obviously with referencing my test image. Thanks in advance for your help! I've attached the test image. Edited June 20, 2014 by mortog Link to comment Share on other sites More sharing options...
JohnOne Posted June 20, 2014 Share Posted June 20, 2014 Screenshot a bmp image instead of jpg. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mortog Posted June 20, 2014 Author Share Posted June 20, 2014 Thanks for the suggestion, it still returns a 0 value though. Link to comment Share on other sites More sharing options...
Sori Posted June 21, 2014 Share Posted June 21, 2014 Try using image search area and telling it to scan the entire desktop. _ImageSearchArea('test.jpeg', 1,0,0,@DesktopWidth,@DesktopHeight,$x,$y,0) If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects. Link to comment Share on other sites More sharing options...
mortog Posted June 21, 2014 Author Share Posted June 21, 2014 That also gives me a result of 0. Could anyone perhaps give me a working example of imagesearch so I can use that to work my way back to what's causing this problem? I'm getting the feeling either my dll file or imagesearch file is wrong. Link to comment Share on other sites More sharing options...
JohnOne Posted June 21, 2014 Share Posted June 21, 2014 The code works fine for me if I create my own desktop BMP so not worth posting the same code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wagnersilva Posted June 24, 2014 Share Posted June 24, 2014 the script is right friend, the folder that contains your script must contain tanbem the image you want to find and ImageSearch file. Use invez bmp to jpeg. Link to comment Share on other sites More sharing options...
keteflips Posted April 20, 2015 Share Posted April 20, 2015 (edited) Same problem here. I copy your script and try with the 32 and 64 bits, but the script always give me 0. Obviously I make an screen shot of an icon of my desktop. #Include <ImageSearch.au3> HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc global $y = 0, $x = 0 While 1 Sleep (2000) Local $search = _ImageSearch('test.jpg', 0, $x, $y, 0) Sleep (2000) If $search = 1 Then MsgBox (0, "" , "succes!") Else msgbox (0, "", $search) EndIf WEnd Finally you make it work? Edited April 20, 2015 by keteflips Link to comment Share on other sites More sharing options...
dinvk Posted April 20, 2015 Share Posted April 20, 2015 (edited) I have same problem too, can't see imagesearch work, im trying to make macro for daily use but seems i cant get the very basic of imagesearch is imagesearch have restriction size? also what .bmp format that work for image search? because while i try to save to .bmp from paint, it give many option of .bmp format (monochrome, 16color, 256color, 24bit of bitmap) im using Win 8.1 64bit and already fix .dll problem and i don't know what else wrong with this anw super noob question for ImageSearchArea im using coor of mouse position from autoit info "Position : 222, 333" [222=x1 , 333=y1 ] right? #include "ImageSearch.au3" HotKeySet("p", "checkForImage") HotKeySet("o", "checkImageSearch") HotKeySet("q", "quit") global $y = 0, $x = 0 Func checkForImage() Local $result = _ImageSearchArea('Untitled.bmp', 1,1, 1, 330, 530, $x, $y, 0) If $result = 1 Then MsgBox(0, "DONE", & $x "," & $y) Else MsgBox(0, "ERROR AREA", & $x "," & $y) EndIf EndFunc Func checkImageSearch() Local $all = _ImageSearch('Untitled.bmp', 1, $x, $y, 0) If $all = 1 Then MouseMove($x, $y, 10) MsgBox(0, "DONE", & $x "," & $y) Else MsgBox(0, "ERROR ALL", & $x "," & $y) EndIf EndFunc while 1 sleep(200) WEnd Func quit() Exit EndFunc Edited April 20, 2015 by dinvk 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