Jump to content

Recommended Posts

Hello fellas im new on auto it

I've been starting to learn and i like this platform so i starting to creeat something i really need

So for the beginning wanted to make a script in sciTe for OCR, i need for automating something


So iwhat i want exccly is to make a simple script who tesseract OCR a location of my screen and then the result to be searched in a file .txt then if it found a word or proposition match or any string then to return me the line where it was found, all words fomr that line. And if it not find it, to write it in a new down line in the same file,then save it.


So i make over now i got to this:


#include <GDIPlus.au3>
#include <Array.au3>
#include <File.au3>

Global $tessarct = "C:\Program Files (x86)\Tesseract-OCR\tesseract.exe"
$sScode = _Tessarct_OCR($tessarct,"zacusca.png",@TempDir&"\out",8)
$file = FileOpen("C:\Users\Marco\Documents\baza.txt", 0)
$read = FileRead($file)

If @error = -1 Then
    MsgBox(0, "Error", "File not read")
    If StringInStr($read, $sScode) Then
      MsgBox(0, "Am gasit raspunsul", $read)

        MsgBox(0, "Oops", "No match")

Func _Tessarct_OCR($tessarct,$img,$out,$psm)
    ; lang vie
    ShellExecute($tessarct, '"'&$img & '" "'&$out&'" -l eng -psm ' & $psm,Default,"open",@SW_HIDE)
    Local $r = FileRead($out&'.txt')
    Return StringStripWS($r,8)


But the problems are few i cant understand them :(

One thing is that in a simple case i just can't figure it out , like if u see the script, so it cant return me the line, just all text, and if I repleace varable ReadLine to FileReadLine then it read only the firs line and i want to read all the file i mean to search the document for a match then return me the line and every ord on it.
Secod is that this tesseract metod that i used as u can see if not what i want it only tesseract a picture, but i want tesseract only a position of the screen what i choose like a box 200x100 to find a text from
And another will be i need to write the result as i said in the same file if it doeas not find any match, is like a auto data base witch find and show me  or if not find, it update it writing it for next time to find it.
So please can you help me, with this script, i know is easy  but i  just dont know what should i make that work :/  

Please any sugesstion i will appreciate  much

p.s. i have tesseract 3.2 installed i have windows 7 ultimate x64 :D

Link to post
Share on other sites
  • Jos locked this topic
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...