Jump to content
Sign in to follow this  
clasher

OCR Problem

Recommended Posts

clasher

Hi all, I am mostly new in autoit but old in coding:(, and I searched all the forums but can't get any help from there.

I am trying to write a basic MTGO trading bot atm, I have got most of the all things work except from OCR.

I tried Real OCR topic, minicap topic, even the same code in climberman's mtgo sample script. I am using vista, and office 2007 also have the regedit and shared folder options for making ocr works.

The problem is that Which script I ever use, it won't make anything:(

The thing that I am looking is the main algorithm for OCR scripts:( or some tips about it:(

I hope you guys help me,

Also all mtgo trading bot script coders can reach me with clasher.my@gmail.com , sharing informations will be good:)

Best regards

Share this post


Link to post
Share on other sites
clasher

This is the code that I am trying to make out. It is the same as climberman's mtgo bot final version ocr part. I will explain my problem below of the code.

#include <GUIConstants.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#include <File.au3>

Func OCR()
    
    Dim $miDoc 
    Dim $Doc
    Dim $str
    Dim $oWord
    Dim $sArray[500]
    Const $miLANG_ENGLISH = 9
    
    $sTargetImage = "C:\Users\clasher\Desktop\Clasher MTGO Bot\images\OCR_tgt.jpg"
    _ScreenCapture_Capture($sTargetImage, 0, 550, 355, 570, $fcursor = false)
    
    $miDoc =ObjCreate("MODI.Document")
    $miDocView = ObjCreate("MiDocViewer.MiDocView")
    $miDoc.Create("C:\Users\clasher\Desktop\Clasher MTGO Bot\images\OCR_tgt.jpg")
    $miDoc.Ocr($miLANG_ENGLISH, 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
    _FileWriteFromArray("C:\Users\clasher\Desktop\Clasher MTGO Bot\images\OCR_tgt.txt", $sArray, 0)
    
Endfunc

Here is the problem.

I think that this code is trying to capture imagefrom the given pixels, and after that it will save it to the directory given there with a name specified. Then it will create modi objects about this capture .jpg file. and with a for loop it will figure it out and write it an array, This is all I figured. Now my questions,

I have all required classes in my regedit file, and all required modi folder in my windows section. I have installed office 2007 3 times in a row. Now when I run this script basically nothing happens, there is no jpg file or txt file created in my folders and it wont capture the words.

I am still looking forward to a just a little help about this code:(

Share this post


Link to post
Share on other sites
clasher

I tried to make the routine manually, I print screened a page, and saved it opened it with Microsoft Office Digital imaging and it clearly saved my word:(

But cant make it with code still

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.