Jump to content

Recommended Posts

Posted (edited)

Very short code, all I did was combined two efforts of other individuals on here to make this. The resulting EXE if you compile can have a BMP file dragged over it and it will "read aloud" the text in that BMP file using the computer's default voice. I would encourage you to do a search on the function names (I haven't changed either of them) and look at what the author originally designed and modify from there. I've been considering using this to develop a small application that can take an image of a paper/form from a Webcam and read the text of it for a blind person.

$BMP = $cmdline[1]
$String = _Img2Txt($BMP)
MsgBox(0,"OCR Text to Read",$String)
_TalkOBJ($string)
Exit

Func _Img2Txt($F, $S = "")
 ; needs at least MS Word XP for "MODI.Document" object
    ObjEvent("AutoIt.Error", "_CoMErrFunc")
    $O = ObjCreate("MODI.Document")
    $O.Create($F)
    $O.Ocr(9);english=9 german=7 spanisch=10
    For $W In $O.Images(0).Layout.Words
        $S &= $W.text & " "
    Next
    Return $S
EndFunc;==>_Img2Txt

Func _TalkOBJ($s_text)
    Dim $oSp = ObjCreate("SAPI.SpVoice")
    $oSp.Speak($s_text)
EndFunc;==>_TalkOBJ

EDIT: Included executable and code in a zip file in case someone needed the binary. Also, this requires Office XP, 2003, or 2007.

EDIT2: Can someone move this to Example Scripts? I put it in the wrong forum..

OCR.zip

Edited by Yorn

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
×
×
  • Create New...