Jump to content

Simple file reading


 Share

Recommended Posts

I have managed to work with tesseract without using tesseratc.au3 include, just using ShellExecuteWait as I found using the command line with tesseract worked just fine.

I am getting tesseract to perform and return a result like this

ShellExecuteWait(@ProgramFilesDir & "\Tesseract-OCR\tesseract.exe", "image.png out")

The result it prints to out.txt is correct but for some reason I cannot display the result with a MsgBox

$file = FileOpen("out.text",0)
$result = FileReadLine($file, 1)

MsgBox(0,"The Result", "Number " & $result)

As tesseract writes it to the first line each time I just want to display it in a msgbox so I don't have to keep checking the text file, what am I doing wrong?

Link to comment
Share on other sites

I have managed to work with tesseract without using tesseratc.au3 include, just using ShellExecuteWait as I found using the command line with tesseract worked just fine.

I am getting tesseract to perform and return a result like this

ShellExecuteWait(@ProgramFilesDir & "\Tesseract-OCR\tesseract.exe", "image.png out")

The result it prints to out.txt is correct but for some reason I cannot display the result with a MsgBox

$file = FileOpen("out.text",0)
$result = FileReadLine($file, 1)

MsgBox(0,"The Result", "Number " & $result)

As tesseract writes it to the first line each time I just want to display it in a msgbox so I don't have to keep checking the text file, what am I doing wrong?

 

your code should read out.txt NOT out.text

:alien:

next time add error check to find problem 

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
Edited by alienclone
If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

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...