Sign in to follow this  
Followers 0
CyberGlitch

Ahk Imagesearch

10 posts in this topic

#1 ·  Posted (edited)

Can we get a function similar to AHKs ImageSearch feature. I know we have PixelCheckSum and others but those don't always work. I've also been playing with a DLL I found mentioned on here before and it crashes sometimes for unknow reasons. Don't know where the DLL came from or anything so looking for another solution and this looks perfect but my beloved AutoIt doesn't handle it.

AHK ImageSearch is fast and finds a saved image on the current screen and returns the X,Y cords.

http://www.autohotkey.com/docs/commands/ImageSearch.htm

I see this was discussed before but not much came of it.

Edited by CyberGlitch

Share this post


Link to post
Share on other sites



Can we get a function similar to AHKs ImageSearch feature. I know we have PixelCheckSum and others but those don't always work. I've also been playing with a DLL I found mentioned on here before and it crashes sometimes for unknow reasons. Don't know where the DLL came from or anything so looking for another solution and this looks perfect but my beloved AutoIt doesn't handle it.

AHK ImageSearch is fast and finds a saved image on the current screen and returns the X,Y cords.

http://www.autohotkey.com/docs/commands/ImageSearch.htm

I see this was discussed before but not much came of it.

What's the DLL that keeps crashing, and what is the DLLCall that your using that keeps crashing it... (That would be handy information).

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I posted about this in the Scripts and Scraps forum a few weeks ago.

http://www.autoitscript.com/forum/index.ph...topic=21629&hl=

The DLL works most of the time but every so often with the same exact code it'll just throw an error.

Yeah, I saw that .dll, but there was nothing on the functions, and no source, so I didn't play with it at all.

Have you tried to put error handling in to trap the error on when and how it happens?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yea, I couldn't find any rhyme or reason to the errors. I image that DLL was somebody's project and was never really finished, hence the errors. I don't have all my scripts here at home to test otherwise I'd post what the DLL error was.

My last resort is going to just code a UDF with AHK and call that with autoit to return back the variables I need. That single function is the only one that I like in AHK and have use for. :)

Edited by CyberGlitch

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

The problem with that though is I've had many checksums be the same but the images are completely different. If we had an ImageSearch function then it would only match on the exact image. Don't get me wrong if there was a way to hash the image into a variable and use that for searches, like PixelChecksum, it would be so much better, if it was 100% accurate. I just never had good results with PixelChecksum and it being a 100% match, more around 60%.

Also the fact that searching the whole desktop can be slow doesn't help either.

Edited by CyberGlitch

Share this post


Link to post
Share on other sites

I'll try to find an image I used to test PixelCheckSum and send it to you. It was one I was playing with for fun. It was the same exact text all the way down the only difference was alternating background colors, only 2. So One would assume you would only have 2 different checksums, 1 for each background seeing as the foreground color and text where the same. I told autoit to go line by line, 14 pixels high, and write the checksums to a text file. Looking through it there was a few similarities but also some anomalies as well. Why this happened I don't know. I've gotta go to the office tomorrow, if I can find the image I'll post it and let you take a look at it.

Excuse me if I'm rambling, it's Saturday and I've have a few glasses of Vodka already. :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Here is one I put together at home that shows 2 errors. If you can explain it then great.

Opt("MouseCoordMode", 0)      ;1=absolute, 0=relative, 2=client

WinActivate("checksum.bmp - Paint")
Sleep(500)

For $y = 69 to 251 STEP 13
    MouseMove(65,$y)
    $checksum = PixelChecksum(65,$y, 133, $y+11)
    
    $file = FileOpen("test.txt", 1)
    
; Check if file opened for writing OK
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf

    FileWriteLine($file, $checksum & @CRLF)

    
    FileClose($file)
Next

Exit

Returns

2249230982

2347134656

2249230982

2347134656

2249230982

2347134656

1274841446

2347134656

2249230982

2347134656

2249230982

2347134656

93483183

117568781

2558851038

checksum.bmp

Edited by CyberGlitch

Share this post


Link to post
Share on other sites

Also, I have used your combo of PixelSearch and PixelCheckSum for other projects at work. The problem with that is if you have to search the whole desktop then it can take upwards of 20 seconds till it finds a match.

I've played around with AHK ImageSearch and it's less then a second no mater where I move the image to be found on the screen, even at 1600x1200 resolution.

Share this post


Link to post
Share on other sites

#10 ·  Posted

Hmm.. That's odd.

That image is a small list of what I have to search through. Most of them are all scrambled though with different sets of numbers. That's a sample that I picked for testing that has a bunch of 10/20 grouped together. What I have to do is go down the list looking for specific set of numbers and once one is found run the rest of my script. It has to be fast though as well.

I'll play with it some more though.

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