strate Posted October 11, 2007 Posted October 11, 2007 I for the life of me can not get this to work. I've installed everything related to the MODI. I'm currently getting an error at lines 48 and 49 before the GUI opens. When I close the window, I have a couple errors at line 68 before the ArrayDisplay. Line 48: $miDoc.Create("C:\WINXP\Fonts\TIMES.TTF") Line 49: $miDoc.Ocr($miLANG_ENGLISH, True, False) Line 68: For $oWord in $miDoc.Images(0).Layout.Words Line 69: $str = $str & $oWord.text & @CrLf Line 70: ConsoleWrite($oWord.text & @CRLF) Line 71: $sArray [$i] = $oWord.text Line 72: $i += 1 Line 73: Next I haven't made any changes to the original script from the first post except for in line 48, the font. Any help would be greatly appreciated. I've been working on this for a couple days now. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
GEOSoft Posted October 11, 2007 Posted October 11, 2007 I for the life of me can not get this to work. I've installed everything related to the MODI. I'm currently getting an error at lines 48 and 49 before the GUI opens. When I close the window, I have a couple errors at line 68 before the ArrayDisplay. Line 48: $miDoc.Create("C:\WINXP\Fonts\TIMES.TTF") Line 49: $miDoc.Ocr($miLANG_ENGLISH, True, False) Line 68: For $oWord in $miDoc.Images(0).Layout.Words Line 69: $str = $str & $oWord.text & @CrLf Line 70: ConsoleWrite($oWord.text & @CRLF) Line 71: $sArray [$i] = $oWord.text Line 72: $i += 1 Line 73: Next I haven't made any changes to the original script from the first post except for in line 48, the font. Any help would be greatly appreciated. I've been working on this for a couple days now.What happens if you change Line 48 to $miDoc.Create("::{D20EA4E1-3957-11d2-A40B-0C5020524152}" & "\Times.ttf") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
strate Posted October 11, 2007 Posted October 11, 2007 Same errors, thanks though. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
strate Posted October 11, 2007 Posted October 11, 2007 (edited) Here are the errors in order.---------------------------COM Error Test---------------------------We intercepted a COM Error !err.description is: File is empty or corruptederr.windescription: 1ED9}\TreatAserr.number is: 80020009err.lastdllerror is: 0err.scriptline is: 49err.source is: err.helpfile is: err.helpcontext is: 0---------------------------OK ------------------------------------------------------COM Error Test---------------------------We intercepted a COM Error !err.description is: EP_E_DCOM_CORE_CREATENUMerr.windescription: ‰홸‰ㆽ矄8err.number is: 80020009err.lastdllerror is: 0err.scriptline is: 50err.source is: err.helpfile is: err.helpcontext is: 0---------------------------OK ------------------------------------------------------COM Error Test---------------------------We intercepted a COM Error !err.description is: Catastrophic failureerr.windescription: Variable is not of type 'Object'.err.number is: 000000A9err.lastdllerror is: 0err.scriptline is: 69err.source is: err.helpfile is: err.helpcontext is: 0---------------------------OK ------------------------------------------------------COM Error Test---------------------------We intercepted a COM Error !err.description is: Catastrophic failureerr.windescription: Variable is not of type 'Object'.err.number is: 000000A9err.lastdllerror is: 0err.scriptline is: 69err.source is: err.helpfile is: err.helpcontext is: 0---------------------------OK ---------------------------All of the line numbers have increased by one due to adding the prior suggestion, it has been commented out though. Edited October 11, 2007 by strate INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
ptrex Posted October 11, 2007 Author Posted October 11, 2007 @strate If the script stops at line 48, the main reason will be that : 1. the TIFF file does NOT exist BEFORE running the script. 2. or the PATH cannot be found by the script. I see that you don't use the default %Windir% location of a standard XP installation. Because your PathName is "WINXP" and should be in a standard installation "Windows" Therefor you can do 2 ways. Try to move the file you are trying to scan into the Script location and try again. Or replace the Path in the script by %WINDIR%\Fonts Regards, 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
strate Posted October 11, 2007 Posted October 11, 2007 Well, I'm a fool, thanks. I googled other MODI.Create statements and found that in the rush and excitement of trying this script that I changed that I thought the image to scan was supposed to be a font file. Needlessly it's working now. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Creator Posted October 16, 2007 Posted October 16, 2007 Maybe handy for acquiring the image to ocr...http://www.autoitscript.com/forum/index.php?showtopic=55308 Possebillities are opening up
Sardith Posted November 2, 2007 Posted November 2, 2007 Ptrex, I'm getting a error on line# 50 $miDoc.Ocr($miLANG_ENGLISH, True, False) Any advice/help? [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]
JPeters Posted November 5, 2007 Posted November 5, 2007 Ptrex, I'm getting a error on line# 50 $miDoc.Ocr($miLANG_ENGLISH, True, False) Any advice/help? I'm getting an error at the same line. I'm using trdis' modification with Minicap, so I posted here in his thread asking about the error.
ConsultingJoe Posted November 6, 2007 Posted November 6, 2007 (edited) Awesome!! Works with Office 2007 also.Me too but I'm getting object error all over. Edited November 6, 2007 by CyberZeroCool Check out ConsultingJoe.com
ptrex Posted November 6, 2007 Author Posted November 6, 2007 @AllWho have Errors ?!I ran the example script from the first page, and everything works fine, under this condition.The CREATE method DOES NOT CREATE ANYTHING.You need to make sure that the fill you are scanning is in that location.$miDoc.Create("C:\Temp\Test.tif")Confusion, I know but that how MS has created it, I can't help it.regardsptrex 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
JPeters Posted November 6, 2007 Posted November 6, 2007 I traced the problem I was having to Minicap saving the screenshot as a rather small image, I think. When I took a screenshot manually and cropped it the OCR worked fine. SmOke_N suggested modifying _Screen_Capture.au3; I'm going to try that now and see if I can get good results.
ptrex Posted November 6, 2007 Author Posted November 6, 2007 @JPeters OK good to hear it works. regards, 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
ConsultingJoe Posted November 6, 2007 Posted November 6, 2007 Still doesn't work for me Object referenced outside a "With" statement.: For $oWord in $miDoc.Images(0).Layout.Words For $oWord in $miDoc.Images(0)^ ERROR Check out ConsultingJoe.com
cgasb Posted December 7, 2007 Posted December 7, 2007 Thanks, this is great. These additions/changes made it more user friendly for me: $FilePath = FileOpenDialog("Select the new file", "", "All files (*.*)", 1) ;browse for the image file If @error Then MsgBox(4096,"","No File chosen") exit EndIf $miDoc.Create($FilePath)
Kilhian Posted February 3, 2008 Posted February 3, 2008 this a function made with your source All credits are for you Ptrex expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> ;~ Dim $test ;~ $test=OCR_Region(0,0,@DesktopWidth,@DesktopHeight) ;~ _ArrayDisplay($test,"result") ;~ ;~ ;~ ;~ ;~ ;~ Func OCR_Region($x,$y,$width,$height) Opt('MustDeclareVars', 1) Dim $miDoc, $Doc Dim $str Dim $oWord Dim $sArray[500] Dim $oMyError Dim $HexNumber Dim $msg Dim $i Const $miLANG_CZECH = 5 Const $miLANG_DANISH = 6 Const $miLANG_DUTCH = 19 Const $miLANG_ENGLISH = 9 Const $miLANG_FINNISH = 11 Const $miLANG_FRENCH = 12 Const $miLANG_GERMAN = 7 Const $miLANG_GREEK = 8 Const $miLANG_HUNGARIAN = 14 Const $miLANG_ITALIAN = 16 Const $miLANG_JAPANESE = 17 Const $miLANG_KOREAN = 18 Const $miLANG_NORWEGIAN = 20 Const $miLANG_POLISH = 21 Const $miLANG_PORTUGUESE = 22 Const $miLANG_RUSSIAN = 25 Const $miLANG_SPANISH = 10 Const $miLANG_SWEDISH = 29 Const $miLANG_TURKISH = 31 Const $miLANG_SYSDEFAULT = 2048 Const $miLANG_CHINESE_SIMPLIFIED = 2052 Const $miLANG_CHINESE_TRADITIONAL = 1028 Local $hBitmap1,$hImage1,$temp $temp=@ScriptDir & "\temp.bmp" _GDIPlus_Startup () ; Capture screen region $hBitmap1 = _ScreenCapture_Capture ("",$x, $y, $width, $height) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1) _GDIPlus_ImageSaveToFile ($hImage1, $temp) _GDIPlus_ImageDispose ($hImage1) _WinAPI_DeleteObject ($hBitmap1) ; Initialize error handler $miDoc = ObjCreate("MODI.Document") $miDoc.Create($temp) $miDoc.Ocr($miLANG_FRENCH, True, False) $i = 0 For $oWord in $miDoc.Images(0).Layout.Words $str = $str & $oWord.text & @CrLf ConsoleWrite($oWord.text & @CRLF) $sArray [$i] = $oWord.text $i += 1 Next FileDelete($temp) Return $sArray EndFunc
ptrex Posted February 4, 2008 Author Posted February 4, 2008 @kilhian Good to see you all got benifit from it !! regards 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
ingonline Posted June 26, 2008 Posted June 26, 2008 Hi everybody, The script doesn't work on my pc. Studing the problem with "OLE/COM Objet Viewer" tool I found the "Microsoft Office Document Imaging Application", but when I try to see more details about it, a popup message notifies me that "CoGetClassObject failed. <no system message defined> REGDB_E_CLASSNOTREG ($80040154)". Will you help me, please? p.s.: please be patience with me for two reasons: a - I'm just a newbie b - My English is very bad!!!
myspacee Posted June 26, 2008 Posted June 26, 2008 Embarassing....works VERY well, now i'm adding select windows to permit user pass coordinates to your function; thank you again ! m.
ingonline Posted June 26, 2008 Posted June 26, 2008 Hi everybody,The script doesn't work on my pc. Studing the problem with "OLE/COM Objet Viewer" tool I found the "Microsoft Office Document Imaging Application", but when I try to see more details about it, a popup message notifies me that "CoGetClassObject failed. <no system message defined> REGDB_E_CLASSNOTREG ($80040154)".Will you help me, please?p.s.:please be patience with me for two reasons:a - I'm just a newbieb - My English is very bad!!!I Anyway continue to have the same problem... The script returns an error: it can't create the object "MODI.document".Regards
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