Jump to content

Just startin Autoit, having trouble with ImageSearch


spartum
 Share

Recommended Posts

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
Link to comment
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

Link to comment
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 :)

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 4 weeks later...

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...