Jump to content
Sign in to follow this  

Little help with OCR plz

Recommended Posts


Hi ,

Trying to understand how OCR works with autoit from what ive put together from other scripts floating around

Got this so far

#include <GUIConstantsEx.au3>

#include <Array.au3>

#include <WindowsConstants.au3>

#include <ScreenCapture.au3>

#include <File.au3>

#include <WinAPI.au3>

#include <GDIPlus.au3>

#include <Misc.au3>

$dll = DllOpen("user32.dll")

$sTargetImage = "mycrap.jpg"

$miDoc = ObjCreate("MODI.Document")

$miDocView = ObjCreate("MiDocViewer.MiDocView")

$Viewer = GUICreate ( "Embedded MODI Viewer", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2)

GUICtrlCreatePic ( $sTargetImage, 320, 290, 0, 0)

GUICtrlSetResizing ($Viewer, $GUI_DOCKAUTO)


GUISetState ()

$MiDocView.Document = $miDoc

$MiDocView.SetScale (1, 1)

_ScreenCapture_Capture($sTargetImage, 450, 350, 650, 500, $fCursor = False)

GUISetState (@SW_HIDE)



$i = 0

$str = ""

For $oWord in $miDoc.Images(0).Layout.Words

$str = $str & " " & $oWord.text

$sArray [$i] = $oWord.text

$i += 1


ConsoleWrite("FROM GETNAME: " & $str & @CrLf)




$sFile = FileOpen(@DesktopDir & "\randomfile.txt", 1)

_FileWrite($sFile, $str, 1)

Which is suppose to work except i get "Error : variable must be type "object" on line $MiDocView.Document = $miDoc"

Any help would really be apreciated.

Share this post

Link to post
Share on other sites

I have added you to my ignored user list.. You need to treat people with respect if you want help, your PMs were anything but respectful.. I tried to help you and you kept insisting that I keep doing all of your work for you... look in the helpfile and look elsewhere for help buddy.. Have a blessed day! PS... Any further action from you and I will report you to the MODS..

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.