2Tricky Posted July 5, 2011 Posted July 5, 2011 Hello. As a newish fan of AutoIt (with some experience) I have decided that it would be great to be able to fill in the spaces that (I deduce) have been left by AutoIt's issues with Windows 7 (specifically things like not being able to read some dialogue box control values) - with Tesseract OCR. I have installed Tesseract 3 (windows installer) and also downloaded Tesseract.au3 kindly written by a poster (Sean Griffin I think) to provide a UDF (I think this means User defined Function - plural in this case) for Tesseract - but I think it was aimed at version 2 mainly. I have a problem. Firstly the site that Seans example scripts use in principle seems to be no longer valid, but secondly I am getting an error that I doubt emanates from this. Here is the error report: C:\Program Files\AutoIt3\Include\Tesseract.au3 (163) : ==> Variable must be of type "Object".: $Obj1.ShowFile ($capture_filename, 1) $Obj1^ ERROR ->11:11:47 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 10.777 I have Googled this to basically no avail and would be grateful for any help - including info on anyone who has actually put Mouse to Screen to write up how to interface with tesseract 3 either with Seans UDP or otherwise. N.B. I have a strong suspicion that it is to do with privileges, rights and just possibly the number 43... (I have tried Windows Virtual PC and XP Mode and had issues too) Thanks a lot - me
MvGulik Posted July 5, 2011 Posted July 5, 2011 Ref: Recognise the text in windows, controls and the desktop "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
2Tricky Posted July 5, 2011 Author Posted July 5, 2011 Ref: Recognise the text in windows, controls and the desktopYep, this is how I know about the file I mentioned (tesseract.au3) with regard to Sean. It only refers to Tesseract version 2.xxx and as I inferred, does not refer to updated URL's for Seans' example file/s to test - but thanks for the post iEvKI3gv9Wrkd41u.
2Tricky Posted July 6, 2011 Author Posted July 6, 2011 Further to my problem. Looking at Seans _TesseractScreenCapture(...) function, I have established that '$capture_filename' (see error code output in original post) holds a temp file name correctly prior to the error and that the file indeed exists and so I deem it not to be a permissions issue. My current interest is to establish where 'preview.preview.1' is defined and whether it relates to Seans own object type or IE's or etc. I've installed oleview from MS as per the AutoIt COM help mention and as a result don't think it is IE's. Maybe I will get somewhere if I examine Seans work to see how it works and then try to workaround the problem. I've flirted with changing back to the earlier Tesseract but am reluctant to persue this because it would of course be going backwards. N.B. I started to try to troubleshoot inside Windows Virtual Machine and XP Mode but realised that I needed to put everything onto that 'machine' - AutoIt, Tesseract, Scite and decided not to but perhaps this is the route of least resistance...we'll see. If anyone can shed light on 'preview.preview.1' as an argument to ObjCreate() that creates the object in the first place, that would be great. Many thanks.
Fload Posted September 13, 2011 Posted September 13, 2011 i too am having the same problems, driving me nuts. Just installed Tesseract 3 gonna see if i can mod the original script to work with it...
Fload Posted September 13, 2011 Posted September 13, 2011 after more searching and searching i found the changes needed to the script here in the forums to make it work for v3, however it is still not working. hangs on tesseract cmd line with error complaining that it cannot open the file ~randomjunk.tif and just crashes... its gotta be something easy im overlooking....
Angoth Posted September 30, 2011 Posted September 30, 2011 Here's what i did. First, I found the line: Global $tesseract_temp_path = "C:\Your Directory\Your place for temp files" and changed the temp path. Then, I made the following changes to the ShellExecuteWait line: ShellExecuteWait("C:\Program Files (x86)\Tesseract-OCR\tesseract.exe", $capture_filename & " " & $ocr_filename, "", "", @SW_HIDE) I put the entire path and the executable in there. Then, I pressed F1 and looked up ShellExecuteWait and found @SW_HIDE. This hides Tesseract's shell window. Worked flawlessly with Tesseract 3.0. BUT!!!!! I haven't gotten the showfile to work correctly in 7. OCR, yes. Showfile, no.
2Tricky Posted October 4, 2011 Author Posted October 4, 2011 Guys, I might have some insight to help - though I am a lot further down the line now since the problem in this thread. From memory (please heed the expression) the showFile wont work on win 7 because the object doesn't exist in win 7. I eventually used:$Obj1 = ObjCreate("WMPlayer.OCX") ;NEW OBJECT REPLACING ORIGINAL IN UDF $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480) With $Obj1 .URL = $capture_filename .fullScreen = True .windowlessVideo = True .stretchToFit = True .enableContextMenu = True .enabled = True .uiMode = "full"; none / mini full .settings.autostart = True .settings.mute = False .settings.volume = 100; 0 - 100 .settings.Balance = 0; -100 to 100 EndWith Notice I am now using WMPlayer.OCX * Now that I have posted again, feel free to ask for any other specifics and I'll do my best to help - though I only visited the forum because I still have probems that I need to research. Good luck - me.
Futsch Posted October 29, 2011 Posted October 29, 2011 Hi 2Tricky, thank you very much for your code, now with Tesseract 3.0 it works with Win7 64bit. I let tesseract try to recognise some numbers out of a flash application. I tried different scales, but all in all i am not very happy with the results. So now I am thinking about to train tesseract. Do you have any experience with that? Again, thanks a lot for your posts.
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