Yorn Posted October 16, 2008 Share Posted October 16, 2008 (edited) (This is a repost in the correct forum, sorry my last post was not in the correct forum) 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. Also, this requires either Office XP, 2003, or 2007. #RequireAdmin $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 Attached is a binary. EDIT: Fixed code and binary to #requireadminOCR.zip Edited October 21, 2008 by Yorn Link to comment Share on other sites More sharing options...
jvanegmond Posted October 16, 2008 Share Posted October 16, 2008 Can't create MODI.Document object. I have Office 2007 though. $BMP = FileOpenDialog("BMP", @AutoItExe,"All (*.*)") If @error Then Exit $String = _Img2Txt($BMP) If Not @error Then MsgBox(0,"OCR Text to Read",$String) _TalkOBJ($string) Else MsgBox(0, "Error","Could not read text") EndIf Exit Func _Img2Txt($F, $S = "") ; needs at least MS Word XP for "MODI.Document" object ObjEvent("AutoIt.Error", "_CoMErrFunc") $O = ObjCreate("MODI.Document") If @error OR Not IsObj($O) Then Return SetError(1,0,0) EndIf $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 github.com/jvanegmond Link to comment Share on other sites More sharing options...
NELyon Posted October 17, 2008 Share Posted October 17, 2008 Can't create MODI.Document object. I have Office 2007 though. $BMP = FileOpenDialog("BMP", @AutoItExe,"All (*.*)") If @error Then Exit $String = _Img2Txt($BMP) If Not @error Then MsgBox(0,"OCR Text to Read",$String) _TalkOBJ($string) Else MsgBox(0, "Error","Could not read text") EndIf Exit Func _Img2Txt($F, $S = "") ; needs at least MS Word XP for "MODI.Document" object ObjEvent("AutoIt.Error", "_CoMErrFunc") $O = ObjCreate("MODI.Document") If @error OR Not IsObj($O) Then Return SetError(1,0,0) EndIf $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;==>_TalkOBJSame. I have Office XP Though. Link to comment Share on other sites More sharing options...
ptrex Posted October 18, 2008 Share Posted October 18, 2008 @Manadar / KentonBombMaybe this can you going MODIRegardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
NELyon Posted October 18, 2008 Share Posted October 18, 2008 (edited) @Manadar / KentonBombMaybe this can you going MODIRegardsptrexAlso fails after installing that package.Still fails after I uninstalled Office XP and dug up my Office 2003 CD. This does not seem to want to work EDIT: The problem is that it fails to initialize the object. Edited October 18, 2008 by KentonBomb Link to comment Share on other sites More sharing options...
Yorn Posted October 21, 2008 Author Share Posted October 21, 2008 Hey guys, I just realized what might be the problem. I did not put #requireadmin in the program, but it probably needs it if you have Vista and UAC. So it looks like I need to fix that. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 21, 2008 Share Posted October 21, 2008 I did not put #requireadmin in the program, but it probably needs it if you have Vista and UAC. So it looks like I need to fix that.On what have you based your conclusion that you need administrator rights to run this? github.com/jvanegmond Link to comment Share on other sites More sharing options...
Yorn Posted October 21, 2008 Author Share Posted October 21, 2008 (edited) It wasn't working, so I figured I'd try this and see what happens. I don't have a Vista computer available at the moment to test with but the old version worked perfectly fine with my implementation of Vista/Office 2007 at work as well as someone else's who I showed it to. Lastly, it also worked on an Office 2003/XP combo at work and the new one works on the same here at home. Alternatively it doesn't require admin and it is likely that you did not install the MODI library with your Office (you did a minimal or otherwise stripped down installation). Maybe it would be best to try a full install (at least to test?). Edited October 21, 2008 by Yorn Link to comment Share on other sites More sharing options...
XnT Posted October 22, 2008 Share Posted October 22, 2008 (edited) EDIT: The problem is that it fails to initialize the object.Just a guess, but if the error is in creating the object, your text to speech may not be installed or setup correctly.EDIT: Sorry, you did say the error was in creating the MODI object and not the voice. my bad. Edited October 22, 2008 by XnT Link to comment Share on other sites More sharing options...
spudw2k Posted January 14, 2009 Share Posted January 14, 2009 I have 2007 and I had to enable OCR under add features for MS Office 2k7. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now