Jump to content

Recommended Posts

Posted (edited)

Analizer library give search features for text and images. You can save screenshot of the window to clipboard, find text/image and click. For applications with not standard GUI it is good choice.

DLL, Wrapper and Sample in archive.

Now you can do these:

#include "analizer.au3"

opt("WinTitleMatchMode", 2)
winwait("SciTE", "")
winactivate("SciTE", "")
AZPrintWindow()
AZTextClick("Search")
AZPrintWindow()
AZTextClick("Find...")
winwait("Find", "")
winactivate("Find", "")
send("Search")
AZPrintWindow()
AZTextClick("Find Next")

Fixed: Optimized text search.

Added: AZTool - tool for manual select text font, extracting images and testing search.

analizer.rar

AZTool.rar

Edited by vertex
  • 2 months later...
  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

Anyone else know more about this? The tool that comes with it looks to solve a lot of peoples questions with finding images on the screen and finding text in images.

I couldn't find anything in google about the DLL and having a hard time recoding some of this to work.

Posted

Where did Analizer.dll come from? Who made it? Where's the licensing information?

Is this some kind of OCR system? If so, I think this will be very useful! I would want to write a wrapper function like OCR($x,$y,$w,$h) that would return an array of strings containing all the text found in that region. Or is there already a function like that?

Posted

I don't know where this dll came from. I was browing the forums last night and stumbled apon it. I've gotten more of it to work already. It seems to have some limiations but they can be worked around.

The example below will use the square.bmp and find the first 4 in testimage.bmp anywhere on the screen(0,0,0,0). It returns back a 2-dim array for all the positive matches. Currently I've found a limitation of it can only find the first 4 matches.

This is the only function I've work on so far as it's something I've need for some time now. PixelCheckSum and other options where just to slow. It does seems you can find and match text with this as well. If an image has the Arial font for example it can pick out the text in the image.

Excuse the mess...

#include "array.au3"
global $AZDLLName = "analizer.dll"

AZPrintWindow()
$var = _findImageOnScreen("square.bmp", "0,0,0,0", 0)

If $var <> 0 Then
    For $r = 1 to UBound($var)-1
        MouseMove($var[$r][1] , $var[$r][2], 20 )
        Sleep(200)
    Next
EndIf

;Find image on screen and return cords
;findFile: File you want to find on the screen
;rect: x,y,width,height
;first: 1 = find first 0 = find all
Func _findImageOnScreen($findFile, $rect, $first)
    Dim $mouseCords[1][3]
    
    $rects = ""
    $trans = 0
    $color = ""

    $result = DllCall($AZDLLName, "int", "image_in_clipscreen_rects", "str", $findFile, "int", $first, "int", $trans, "str", $color, "str", $rect, "str", $rects)

    AZDllError("AZTextRects")
    $rects = $result[6]
;MsgBox(0,"",$rects)

    if $rects <> "" then
        $rects = stringright($rects, stringlen($rects) - 1)
        $rects = stringsplit($rects, ";")
        $mouseIndex = $rects[0]
        ReDim $mouseCords[$mouseIndex+1][3]
    else
        $rects = _arraycreate(0)
    endif

    if $rects[0] < 1 then
        return 0
    endif
    
    
    if ($rects[0] <> 0) then
        For $n = 1 to $mouseIndex
    ;MsgBox(0,$n,$rects[$n])
            $items = stringsplit($rects[$n], ",")
            if $items[0] = 4 then
                $mouseCords[$n][1] = $items[1] + $items[3] / 2
                $mouseCords[$n][2] = $items[2] + $items[4] / 2
            
                $pWidth  = $items[3]
                $pHeight = $items[4]
            ElseIf $items[0] = 3 then
                $mouseCords[$n][1] = $items[1] + $pWidth / 2
                $mouseCords[$n][2] = $items[2] + $pHeight / 2
            Else
                AZTraceError("Index of the needed text rect out of bounds.")
                AZExit()
            Endif
            
        ;MsgBox(0,$mouseCords[$n][1],$mouseCords[$n][2])
            

        Next
    else
        $items = _arraycreate(0)
    endif

    return $mouseCords
EndFunc


; Print window to clipboard (don't ALT PRINTSCREEN)
func AZPrintWindow()
    $result = DllCall($AZDLLName, "none", "active_window_to_clip")
    AZDllError("AZPrintWindow")
endfunc

;Error
func AZDllError($func)
    if @error <> 0 then AZTraceError("'" & $func & "' function run error")
endfunc

; Tracing error
func AZTraceError($error)
    MsgBox(16, "Analizer error.", $error)
endfunc

square.bmp

testimage.bmp

Posted

I don't know where this dll came from.

Sound dangerous. Maybe you should fix that before you go any further...

Who wrote this DLL?

Where can you get the newest version?

How do you know it doesn't have any dangerous code (either intentional or accidental) in it?

How do you know you have the right to use it?

How do you know you have the right to re-distribute it?

If an image has the Arial font for example it can pick out the text in the image.

Are you saying that it can only find the arial font? Or were you just giving an example?
Posted

I know it's dangerous to use. I'm doing this on my test machine, that's always getting reformatted anyways. So anything dangerous in there, i don't care about. The only thing that does scare me is any licensing info. I've already stopped now that I know it can do what I want, I'm trying to find out where this thing came from.

I was just using an example. You can load any font file you want from your computer. You would do something similar to my current function with an added font field and it'll find all text in that font in the rectangle you give it.

This thing has a lot of potential and could solve a lot of peoples problems with OCR and image recognition. Just need to find out where the DLL came from.

Posted

Still no idea where it came from. But my firewall hasn't bliped a bit and a dump shows only these exports. Don't see anything in the dump to give a hint of where it came from, but I'm not expert.

; Exports
;
    Index: 1    Name: image_in_clipscreen_rects
    Index: 2    Name: image_in_clipscreen
    Index: 3    Name: active_window_to_clip
    Index: 4    Name: text_in_clipscreen_rects
    Index: 5    Name: text_in_clipscreen
Posted

Ok, there is nothing in the dll to give a hint of where it came from. I know all the exports and don't see anything suspicious. The only other thing I know is it was created in Borland Delphi and that's it. I find it hard to believe if this was a commercial dll that they wouldn't have their name splattered all over the dll. For now I'm going to assume it was someones pet project (vertex maybe) and that there is no harm using this file until told otherwise.

I'm no expert, use at your own risk. :think:

Posted

Any news on this topic? It's a really great tool, I'd like to hear more then what's here =/

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Posted

I haven't had much more time to mess with it to be honest. It looks to have 2 main functions find image on screen and find text on screen. So if you are looking for a certain image or a certain string of text it'll find it and can pass back to coordinates to you. Don't think it would work to well for OCR but, if you want to know if a certain string is in a certain rectangle you could know if it's there or now.

I guess you could try going through the whole alphabet searching and then sort by the x,y cords to put everything in order.

  • 3 months later...
Posted

Could someone inform me on what to change if I want to search the screen for "test.bmp" and click the picture.

$image = _findImageOnScreen("test.bmp", "0,0,0,0", 0)


If $image <> 0 Then
    For $r = 1 to UBound($var)-1
        MouseClick($var[$r][1] , $var[$r][2], 20 )
        Sleep(200)
    Next
EndIf

Dosnt work ([took code from example]I have test.bmp in the same directory)

Thanks in advance

~Vivvic~

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

  • Moderators
Posted

Could someone inform me on what to change if I want to search the screen for "test.bmp" and click the picture.

$image = _findImageOnScreen("test.bmp", "0,0,0,0", 0)
If $image <> 0 Then
    For $r = 1 to UBound($var)-1
        MouseClick($var[$r][1] , $var[$r][2], 20 )
        Sleep(200)
    Next
EndIf

Dosnt work ([took code from example]I have test.bmp in the same directory)

Thanks in advance

~Vivvic~

Would be cool if this question would quit being deleted and reposted... stupid way to bump.

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.

Posted

Yeah, sorry but I find posts that simply say "bump" a little bland so Thats how I decided I would "fake-bump" my post.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

  • 2 weeks later...
  • 2 weeks later...
Posted (edited)

Sorry, i did not follow the topic. I try to reply some asked questions.

> Where did Analizer.dll come from? Who made it?

I writed analizer.all analizer tool and wrapper.

> Where's the licensing information?

You can do with this code and tool all what you want.

This tool is not OCR. I will upload the source code later today.

Edited by vertex
Posted

Sorry, but now i have only old version of the analizer DLL. I can post it, but don't sure that this source code correct. May be it useful for examination with project. Last version i will upload in a few days. Also you need Delphi 7 and FastDIB component for building project.

dll.rar

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
  • Recently Browsing   0 members

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