ptrex Posted October 5, 2010 Author Share Posted October 5, 2010 @coopdaveel You are welcome ! But sharing your code is what it about out here Rgds ptrex 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...
Eguun Posted April 3, 2011 Share Posted April 3, 2011 (edited) Hello Folks, I am facing an issue when trying to use this fonction. First of all, thank you Ptrex: your code was really helpful. Unfortunatly, it crashes after a while. Here below is my code to reproduce the crash. I only get the "classic" error message stating that autoit crashed and I can report the issue to microsoft. I don't even get the popup I asked for that could intercept the problem and tell me more about the error code. Any pointer would be really helpful. I am using Windows XP service Pack 3 and tried with these different versions of office: Office 2007 Office 2007 SP2 I realize this thread is quite old, I hope someone is still monitoring it. Cheers expandcollapse popup#include <Array.au3> Global Const $miLANG_CZECH = 5 Global Const $miLANG_DANISH = 6 Global Const $miLANG_DUTCH = 19 Global Const $miLANG_ENGLISH = 9 Global Const $miLANG_FINNISH = 11 Global Const $miLANG_FRENCH = 12 Global Const $miLANG_GERMAN = 7 Global Const $miLANG_GREEK = 8 Global Const $miLANG_HUNGARIAN = 14 Global Const $miLANG_ITALIAN = 16 Global Const $miLANG_JAPANESE = 17 Global Const $miLANG_KOREAN = 18 Global Const $miLANG_NORWEGIAN = 20 Global Const $miLANG_POLISH = 21 Global Const $miLANG_PORTUGUESE = 22 Global Const $miLANG_RUSSIAN = 25 Global Const $miLANG_SPANISH = 10 Global Const $miLANG_SWEDISH = 29 Global Const $miLANG_TURKISH = 31 Global Const $miLANG_CHINESE_SIMPLIFIED = 2052 Global Const $miLANG_CHINESE_TRADITIONAL = 1028 Dim $screenshot_dir=@MyDocumentsDir & "\screenshots\" Dim $screenshot_file="screenshot.tif" Global $Error = False Dim $i=0 ; loop to use ocr function some times (using 2 seconds pause in between) ; this eventually lead to a crash While $i<1000 Dim $oMyError = ObjEvent("AutoIt.Error","OCRErrFunc") $sArray = OCRGet($screenshot_dir & $screenshot_file, $miLANG_ENGLISH) ; _ArrayDisplay($sArray, "OCR Result") Sleep(2000) $i+=1 WEnd Func OCRGet($Image, $Lang=9) Local $sArray[1], $oWord Local $miDoc = ObjCreate("MODI.Document") $miDoc.Create($Image) If @error Then Return SetError(1) $miDoc.Ocr($Lang, True, False) If @error Then Return SetError(2) Return $sArray EndFunc ;------------------------------ This is a COM Error handler -------------------------------- Func OCRErrFunc() $HexNumber = hex($oMyError.number, 8) Msgbox(0,"COM Error Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext) SetError(1) ; to check for after this function returns Endfunc Edited April 3, 2011 by Eguun Link to comment Share on other sites More sharing options...
Eguun Posted April 4, 2011 Share Posted April 4, 2011 Hi, I managed to get around the crash by running the OCR as an external script from my main script. When it crashes I make my main script check for the error message and simply click the button. It's all good now Cheers Link to comment Share on other sites More sharing options...
Eemuli Posted September 21, 2011 Share Posted September 21, 2011 Hi everyone! I ran into trouble when running the OCR MODI autoit script. MODI object couldn't be found even though I have MODI installed and working.The problem was that AutoIt was compiling the script in x64, when MODI runs in x86. This also affected to running the script straight from AutoIt Scite (F5). Solution:From AutoIt SciteOpen AutoIt compile (ctrl+F7) -> select tab "Aut2Exe" -> select "Compile X86 version." I am using Win7 X64 with Office 2007.AutoIt Scite Version 2.27 (Jun 24 2011 17:46:25). I hope this saves someone from trouble of finding the error Since office 2010 is making it's way to users and it doesn't support MODI anymore, here is how you can use MODI with Office 2010:http://support.microsoft.com/kb/982760file:///C:/Users/Eemeli/Desktop/Compile-in-x86.png Link to comment Share on other sites More sharing options...
AutoitMike Posted July 17, 2012 Share Posted July 17, 2012 (edited) Can someone please help me out. I copy and paste the script, run it and I am getting "We intercepted a com error" The line with the offending code is "$miDoc.ocr($miLan_English, True, False) Pleas help!, I really need this Thanks Edited July 17, 2012 by AutoitMike Link to comment Share on other sites More sharing options...
ptrex Posted July 18, 2012 Author Share Posted July 18, 2012 @AutoitMike I am not surprised to see errors come up in a 5 year old script Anyhow try to add this to the top of the script if you are running on a x64 Windows 7. #AutoIt3Wrapper_UseX64=N Rgds, ptrex 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...
AutoitMike Posted July 19, 2012 Share Posted July 19, 2012 I am using XP autoit mike Link to comment Share on other sites More sharing options...
AutoitMike Posted July 19, 2012 Share Posted July 19, 2012 BTW, I dont need this script in the way it runs. I will do a screen capture of an area and then I need that OCR'ed EG _ScreenCapture($File, $TopLeft, $BottomRight) So just how can I integrate the code to do this? Thanks Link to comment Share on other sites More sharing options...
ptrex Posted July 19, 2012 Author Share Posted July 19, 2012 @AutoITMilkeWhy would you want to make this if others have already done it before ?Please read through the whole thread and you will posts like this.Rgds,ptrex 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...
AutoitMike Posted July 23, 2012 Share Posted July 23, 2012 PtrexThanks very much fir the link to Kilhian's code.It works , albeit dropping occasional letters.I am able to find and study many of the _GDI functions, however, I cant seem to find documentation on how "$miDoc.Ocr($miLANG_ENGLISH, True, False)" actually works or how I could ever derive to this line of code, so I dont know what "True, False" is referring to.If you could point me to this I would very much appreciate it.Thanks Link to comment Share on other sites More sharing options...
GiulioM Posted July 23, 2012 Share Posted July 23, 2012 3 stars, because you addd such a great feature, although you didn't write the OCR part. Link to comment Share on other sites More sharing options...
ptrex Posted July 24, 2012 Author Share Posted July 24, 2012 @AutoITMikeMaybe this can give you a clue.expression.OCR(LangId, OCROrientImage, OCRStraightenImage)OCROrientImage Optional Boolean. Specifies whether the OCR engine attempts to determine the orientation of the page. Default is true.OCRStraightenImage Optional Boolean. Specifies whether the OCR engine attempts to "de-skew" the page to correct for small angles of misalignment from the vertical. Default is true.Rgds,Ptrex 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...
AutoitMike Posted September 11, 2012 Share Posted September 11, 2012 Ptrex,I found the documentation on Microsofts site searching "Modi.document"I see that there is a function OnOcrProgress that returns the progress of the OCR "Progress" but it seems that this can only work in VB. A sample code script is given:Private Sub mmiDoc_OnOCRProgress(ByVal Progress As Long, Cancel As Boolean) ;mmidoc is previously created as a document object ' Cancel if user has clicked the Cancel button. If mblnCancel Then Cancel = True End If ' Indicate progress on the ProgressBar control pbrOCRProgress.Value = Progress End SubThe actual use is defind as: expression.OnOCRProgress(Progress, Cancel) where expression is a document object.This is called periodically during an optical character recognition (OCR) operation. However, I cant make it work in AutoItIs it possible?ThanksMike Link to comment Share on other sites More sharing options...
AutID Posted September 7, 2013 Share Posted September 7, 2013 Doesn't seem to run on office 2010.I am missing all MODI files... https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
spudw2k Posted September 7, 2013 Share Posted September 7, 2013 Is Optical Character Recognition (OCR) installed in the Installation Options for Office 2010? You can check this via the Programs and Features Control Panel Applet and Clicking the Change button after selecting Office in the list. 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...
AdamUL Posted September 8, 2013 Share Posted September 8, 2013 Have a look at this from Microsoft support. Install MODI for use with Microsoft Office 2010 Link to comment Share on other sites More sharing options...
AutID Posted September 8, 2013 Share Posted September 8, 2013 Is Optical Character Recognition (OCR) installed in the Installation Options for Office 2010? You can check this via the Programs and Features Control Panel Applet and Clicking the Change button after selecting Office in the list. OCR is installed in mircosoft 2010. I cant seem to find any Modi documents though https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
spudw2k Posted September 9, 2013 Share Posted September 9, 2013 I'm not sure what you mean by Modi documents. Can you elaborate or explain what you are trying to do that is not working? 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...
Jseaz73 Posted October 10, 2014 Share Posted October 10, 2014 Will this work on a region of a screen or am I better off using Tesseract? Link to comment Share on other sites More sharing options...
ptrex Posted October 14, 2014 Author Share Posted October 14, 2014 @Jseaz73 Yes it does work using selecting the screen region. The only downside of this library is that is relies 100 % on MS Office. So if you don't have the proper version installed it will not find the needed COM object. But I am still using this frequently up till now. rgds ptrex 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...
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