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")
Exit
Else
If StringInStr($read, $sScode) Then
MsgBox(0, "Am gasit raspunsul", $read)
Else
MsgBox(0, "Oops", "No match")
EndIf
EndIf
FileClose($file)
Func _Tessarct_OCR($tessarct,$img,$out,$psm)
FileClose(FileOpen($out&'.txt',10))
; lang vie
ShellExecute($tessarct, '"'&$img & '" "'&$out&'" -l eng -psm ' & $psm,Default,"open",@SW_HIDE)
ProcessWaitClose('tesseract.exe')
Sleep(100)
Local $r = FileRead($out&'.txt')
Return StringStripWS($r,8)
EndFunc
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