Sign in to follow this  
Followers 0
spartum

Just startin Autoit, having trouble with ImageSearch

8 posts in this topic

#1 ·  Posted (edited)

I've done minimal coding in the past (html, css, java, php). Java / php mostly being from tutorials then tweaking for my own needs.

I want to learn to use this program so I can write some of my own scripts, and the ImageSearch function is required for almost all of my plans.

I tried following this tutorial, and seem to have failed :/

Edited by spartum

Share this post


Link to post
Share on other sites



Okay, after bouncing around the forums, reading, googling, etc. I figured out I had the imagesearch.au3 file and the .dll files in the wrong locations, + I needed to run the script as x64.

So if anyone else shows up here with questions like mine, the Imagesearch.au3 file goes to "C:\Program Files (x86)\AutoIt3\Include\" and the .dll goes to "C:\Windows\System32\"

And for the record, my silly message boxes worked too! :D

Share this post


Link to post
Share on other sites

So just by moving the udf to the include path and the dll to system32 solved the problem???

I have a compiled project which crashes on windows 8. I have the dll in the same directory as the exe. I will try to move it in the system32 and see what it gives.

If that is the case, you made my day.

Welcome to the forum.

Share this post


Link to post
Share on other sites

So just by moving the udf to the include path and the dll to system32 solved the problem???

I have a compiled project which crashes on windows 8. I have the dll in the same directory as the exe. I will try to move it in the system32 and see what it gives.

If that is the case, you made my day.

Welcome to the forum.

That and then instead of just running the script, I right click > Run as x64

It was also suggested (in the youtube video comments I think) to try as x86 as well. x86 didn't do it for me, but x64 did.

Let me know how it went for you :)

Share this post


Link to post
Share on other sites

The x86 or x64 depends on the OS you have.
I didn't tried it yet. What I am understanding from this is that the windows 8 are missing some standard dlls that windows 7 have.
I have winhttp and bass dlls included on my project so that's why my script was crashing I suppose.
Thank you anyway.

Share this post


Link to post
Share on other sites

FINALLY! an uptodate post about 'ImageSearch'! You have no idea how fustrated I've been trying to work this thing.

I followed the above instructions (and used the 'silly' script as a tester) and I'm forever greatful for you :) Thank you soooooooo much

I'm using Win7 and the outcome is the same.

A couple of notes -  _ImageSearch('FINDME!.bmp', 0, $X, $Y, 0) will return the $X, $Y co-ords of the top left corner of the image
                                _ImageSearch('FINDME!.bmp', 1, $X, $Y, 0) will return the $X, $Y co-ords of the center of the image

Also as I found out when editing the picture in Paint, (printscreen, paste, select image part and re-paste;) ensure you shrink the 'White' area to match or
overlap the Image you pasted. Any white border, unless it's part of the image you want to find, will return a 'False' value.

Share this post


Link to post
Share on other sites

I get this error

"C:\Program Files (x86)\AutoIt3\Include\ImageSearch.au3" (40) : ==> Subscript used on non-accessible variable.:
if $result[0]="0" then return 0
if $result^ ERROR
 
But if i change to 
 
If $result="0" then return 0
 

I always get 00 for coords, any ideas why?

#Include <ImageSearch.au3>

HotKeySet ("{F1}","_Start")
HotKeySet ("{F4}","_Exit")

$x=0
$y=0

Func _Start()
   local $search=_ImageSearch(".\bin\search\test.png",1,$x,$y,10)
   ConsoleWrite("-Found "&$x&$y&@CRLF)
   If $search=1 Then
      MouseMove($x,$y,10)
      ConsoleWrite("-MouseMovedTo "& $x & $y & @CRLF)
   EndIf
EndFunc

While 1
   sleep(100)
WEnd

Func _Exit()
   MsgBox(0,"Quit","Hit OK to Exit")
   Exit
EndFunc

Share this post


Link to post
Share on other sites

You may want to start your own thread instead of jumping on this existing one.

Also, I'm guessing that you are running an older version of AutoIt. Try upgrading to the latest to see if that addresses your issue.

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