TheViper Posted May 31, 2013 Share Posted May 31, 2013 Hello, I am new to the forums, and AutoIt, and I have a question. How do I use OCR with AutoIt? After some searching, I found that Tesseract would be a suitable solution, but on my test script I get this error: So does anyone know what I can use for OCR? The image I need to read is below: Regards. Link to comment Share on other sites More sharing options...
Rux Posted May 31, 2013 Share Posted May 31, 2013 This is a problem with the UDF's code. You should try and ask the author directly. Link to comment Share on other sites More sharing options...
TheViper Posted May 31, 2013 Author Share Posted May 31, 2013 This is a problem with the UDF's code. You should try and ask the author directly. Thanks, I'll try, but do you know of any other OCR UDFs? Link to comment Share on other sites More sharing options...
jdelaney Posted May 31, 2013 Share Posted May 31, 2013 (edited) modi ocr...you need to download the driver from Microsoft (part of the sharepoint distributer...it's free)...then, you can use it's api...google vbs modi, and it will show you how, that's easy to then convert to au3 what is the reason? There are much easier/better/more accurate ways to get text Edited May 31, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
JohnOne Posted May 31, 2013 Share Posted May 31, 2013 There is no real way to tell where the problem lies with only an error message, it might manifest itself from the UDF, but all manner of things might be wrong with your own code which causes it. In short: Show your code, or a short reproducer that others can run. 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 More sharing options...
guinness Posted June 1, 2013 Share Posted June 1, 2013 Where is that image from please? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
nitekram Posted June 1, 2013 Share Posted June 1, 2013 I will add to this. I have tried this UDF () and it takes a long time to parse the data and then it is only about 15-25 percent right, it seems to get the first 15-20 chars right and then drifts off to garbage...I am wondering if there is another way of doing this. I am going to look and see about vbs modi, if I get it working, I will post.@jdelaney -->> can you tell me an easy was to grab text from a window? I have an image basically and need to be able to get the text fast. Even when I tried the above UDF - it took to long, I might as well used the export from the window, as that would be faster. It exports to an excel file, but no hot keys to allow automation. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
JohnOne Posted June 1, 2013 Share Posted June 1, 2013 There is a perfectly good UDF for modi in autoit. 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 More sharing options...
jdelaney Posted June 1, 2013 Share Posted June 1, 2013 I use this: expandcollapse popupFunc Var_OCRGet($Image, $Lang=9) ; Get the OCR text $giSubFunctionCounter += 1 If $gbPerformLog Then Var_SetLogAndActOnState(2, $gbLogLevel_Strt, "Var_OCRGet()", "Func=[Var_OCRGet]: Start with Params=[" & $Image & "].", $gbDisplayInformMessage, $gbTerminateOnFailure) Local $sArray[1], $oWord Local $oErrorHandler = ObjEvent("AutoIt.Error", "Var_ErrFunc") If IsObj ( $oErrorHandler ) Then If $gbPerformLog Then Var_SetLogAndActOnState(2, 3, "Var_OCRGet()", "Func=[ObjCreate]: able to create ObjEvent=[" & "AutoIt.Error" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure) Else If $gbPerformLog Then Var_SetLogAndActOnState(0, $gbLogLevel_Rtrn, "Var_OCRGet()", "Func=[ObjCreate]: UNable to create ObjEvent=[" & "AutoIt.Error" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure, False) $giSubFunctionCounter -= 1 $miDoc = "" $oErrorHandler = "" Return SetError(1) EndIf Local $miDoc = ObjCreate("MODI.Document") If IsObj ( $miDoc ) Then If $gbPerformLog Then Var_SetLogAndActOnState(2, 3, "Var_OCRGet()", "Func=[ObjCreate]: able to create ObjCreate=[" & "MODI.Document" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure) Else If $gbPerformLog Then Var_SetLogAndActOnState(0, $gbLogLevel_Rtrn, "Var_OCRGet()", "Func=[ObjCreate]: UNable to create ObjCreate=[" & "MODI.Document" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure, False) $giSubFunctionCounter -= 1 $miDoc = "" $oErrorHandler = "" Return SetError(1) EndIf $miDoc.Create($Image) If Not @error Then If $gbPerformLog Then Var_SetLogAndActOnState(2, 3, "Var_OCRGet()", "Func=[ObjCreate]: able to run method=[" & "$miDoc.Create" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure) Else If $gbPerformLog Then Var_SetLogAndActOnState(0, $gbLogLevel_Rtrn, "Var_OCRGet()", "Func=[ObjCreate]: UNable to run method=[" & "$miDoc.Create" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure, False) $giSubFunctionCounter -= 1 $miDoc = "" $oErrorHandler = "" Return SetError(2) EndIf Sleep (2000) $miDoc.Ocr($Lang, True, False) If Not @error Then If $gbPerformLog Then Var_SetLogAndActOnState(2, 3, "Var_OCRGet()", "Func=[.Ocr]: able run method=[" & "$miDoc.Ocr" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure) Else If $gbPerformLog Then Var_SetLogAndActOnState(0, $gbLogLevel_Rtrn, "Var_OCRGet()", "Func=[.Ocr]: UNable run method=[" & "$miDoc.Ocr" & "].", $gbDisplayInformMessage, $gbTerminateOnFailure, False) $giSubFunctionCounter -= 1 $miDoc = "" $oErrorHandler = "" Return SetError(3) EndIf For $oWord In $miDoc.Images(0).Layout.Words ReDim $sArray[UBound($sArray)+1] $sArray[UBound($sArray)-1] = $oWord.Text Next $sArray[0] = UBound($sArray)-1 If $gbPerformLog Then Var_SetLogAndActOnState(2, 3, "Var_OCRGet()", "Func=[Var_OCRGet]: returning array of text=[UBound=(" & UBound ( $sArray ) & ")].", $gbDisplayInformMessage, $gbTerminateOnFailure) $giSubFunctionCounter -= 1 $miDoc = "" $oErrorHandler = "" Return $sArray EndFunc You would need to comment out quite a bit. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
nitekram Posted June 2, 2013 Share Posted June 2, 2013 My only problem is that I do not have MODI installed on these computers - work inviroment. Not sure why they would not install it by default, but that is what happened. Maybe when we get our new computers in April LOL, they will have it installed. Until then, I go back to my trusted, send('{tab}') - I really hate when developers do not use Microsoft GUI's Sorry if I highjacked this thread, but all the other threads were over 2 years old. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
TheViper Posted June 3, 2013 Author Share Posted June 3, 2013 Where is that image from please? Does it matter where it's from? It's just an example of what I need to read with the OCR. Link to comment Share on other sites More sharing options...
guinness Posted June 3, 2013 Share Posted June 3, 2013 (edited) Well it looks like a game image, that's why I asked. Secondly, it does matter, due to the fact there might be a different approach to obtaining the time other than the image. "Many hands make light work" Though your cocky response leads me to think you're breaking the rules. Edited June 3, 2013 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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