Sign in to follow this  
Followers 0
mortog

imagesearch won't work

9 posts in this topic

#1 ·  Posted (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. post-64901-0-36825400-1403277240.jpg

Edited by mortog

Share this post


Link to post
Share on other sites



Thanks for the suggestion, it still returns a 0 value though.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by keteflips

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by dinvk

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • magmet00
      By magmet00
      Do you have a working imagesearch.au3 with working dll?
      and how can i gethandle and send keyboard/mouse commands to hidden d3d window?
       
      i have tried imagesearch2015 but im getting dll error every time and tried older imagesearchs too in forum what i found.
      i have tried many things to send commands to hidden/background d3dwindow still nothing works.
      Can you help me please?
       
    • knuxfighter
      By knuxfighter
      Hello. I've been working with Imagesearch library lately and it did a good work, although I moved to a new PC and didn't copy the old files with me so I downloaded the Imagesearch from the following post
       hoping that it will work. It doesn't though. First time I when I use (run as subscript to my code) the Imagesearch.au3, Scite finds errors (missing spaces). Ctrl+T (scite tidy) fixes these missing spaces but the script returns the following error on every run after:
      _ImageSearch('search.bmp', 0, $x, $y, 0) outputs
       
      "C:\Users\Knuckles\Desktop\AutoIt\include\ImageSearch.au3" (44) : ==> Subscript used on non-accessible variable.: If $result[0] = "0" Then Return 0 If $result^ ERROR no matter if I put the searched bmp in the script folder or folder img in the script directory. Also, it doesn't matter if the searched image on screen or not, it returns the same.

      Can you provide me any help please? I remember having these problems 2 years ago when I first met the imagesearch library also (I fixed it somehow though in that time). Seems nothing changed.

      Using this version posted in the following post gives the same error:
      Also I run windows 10 64bit and I have no shell options for script editing, running as x86 or whatever as I used to have on windows xp/7. I went through some steps like deleting a key in registry and I even reinstalled autoit and scite but that only resulted to au3 as unrecognized file format and not in getting back the menus and the icon on au3 files. Any thoughts on this?

      Edit: Installing 64-bit AutoIt and using 64bit ImageSearch is no change.
      code.au3

      FOUND WORKING: http://www.codebot.de/index.php/Thread/12713-Imagesearch-au3-funktioniert-nicht/
       but why is this one working and the original aren't? :(
    • masterland
      By masterland
      Hello.
      I had made a bot that clicks and doing stuff. It is working fine, but when i move it to another PC ImageSearch stop working. I captured same image of a button again and i observed that they are a little bit different. How to deal with this? I wonder if i will make black and white detection might work, or not ... i don't know. The point is i am not willing to re-do photos on each and every PC i move the scripts.
       
      ClickOnImageWithToleranceFast("images/fb_about.bmp",16) Func ClickOnImageWithToleranceFast($image_path,$tolerance) If SearchForImageOnScreenWithTolerance($image_path,$tolerance) Then If $x <> 0 And $y <> 0 Then MouseMove($x+5, $y+5,0) Sleep(500) MouseClick("left") Sleep(500) EndIf EndIf EndFunc  
      Link : https://postimg.org/gallery/z6n168ps/585debf1/#
      Also i have attached them.
      Thank you
      fb_about.bmp
      fb_about2.bmp
    • Miliardsto
      By Miliardsto
      Hello i got problem with ImageSearchDll.dll
      It works for me perfect always I made program which one use a lot of ImageSearch funcs on 64bit.
      I got 64bit and i copied to c:/Windows - ImageSearchDll.dll 64bit version
      But I encountered some friends got 32bit OS and then if I compile program for 32bit then they put ImageSearchDll.dll 32bit ver on windows dir and program crash when function is call.
      it happens always :/
       
      How to run this func on 32bit?
    • SaeidN
      By SaeidN
      Hi,
      I saw a couple topics about both mousedrag and imagesearch in background or minimized window, but none of them has the solution, and they were old topics.
      So I wanted to ask whether there is a way to mouse drag without the cursor to move, (I want to use mouse when mousedrag is working on a window). I don't know whether I can mix ControlMove with some other stuff or any other way?
      And also for the image search, is there any way to search for image (or pixel) in a background or minimized window? I thought maybe there is a au3 or dll or ... file for doing this.
      Another question I have: Any way to pinch zoom (two fingers) a window like "windows photo viewer" to zoom in or out? I saw something almost the same here, but not what I want.
      I appreciate it.