Jump to content

Tesseract OCR issues


Recommended Posts

Hello,

I've been messin around with the Tesseract OCR using SeanGriffin's UDF found here:

http://www.autoitscript.com/forum/index.php?showtopic=89542&st=0

When I test the script stand-alone using:

$test1 = _TesseractScreenCapture(0, "", 1, 2, 1550, 5, 870, 841, 1)
MsgBox(0, "OCR test", $test1)

everythings working as it should be, with no error's.

However, once I try to use this in my own script, i keep receiving an error. I'm not sure what's going although i'm certain it has something to do with my script interacting with it. Here's the snippet of my script that uses the OCR followed by the error i'm receiving:

$userID = _TesseractScreenCapture(0, "", 1, 2, 1550, 5, 870, 841, 0)

    $sFilePath = @DesktopDir & "\autoitscripts\test.xls"

    _ExcelBookOpen($sFilePath, 0)
    $oExcel = _ExcelBookAttach("test.xls", "FileName")

    $i = 1

            Do

                $sCellValue = _ExcelReadCell($oExcel, $i, 1)

                $i = $i + 1

            Until $sCellValue = $userID

            If @error = 1 Then

                MsgBox(0, "Test", "User not found.")

            Else

                MsgBox(0, "User ID is:", $userID)

            EndIf


$credit = _ExcelReadCell($oExcel, $i - 1, 2)

_ExcelBookClose($oExcel, 0)

The error i'm receiving(the error is in the UDF for some strange reason, no idea why):

Line 155 (File "C:\AutoIt\AutoIt3\Include\Tesseract.au3"):

$capture_filename = _TempFile($tesseract_temp_path, "~", ".tif")

^ERROR

Error: Variable used without being declared.

Unfortunately, i've only been using AutoIt for about a week now, so i'm still a beginner when it comes to this stuff and have no idea how to go about fixing this.

Can anyone help me get this issue resolved? It would be greatly appreciated.

Thanks in advance!

Link to comment
Share on other sites

I dont know why that would happen, but you could try adding this into the function at about line 137.

Local $capture_filename

EDIT: perhaps this might occur if you have used Opt("MustDeclareVars", 1) option in your script, but Im not 100% on that.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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