
AutoitMike
Active Members-
Posts
194 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by AutoitMike
-
OCR and MODI MiRect property
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
9, Thanks ever so much, It works. I had a little trouble figuring out where to insert the code, which is right after: $miDoc.Ocr($miLANG_ENGLISH, True, False) -
OCR and MODI MiRect property
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Thanks 9 I will try this out. -
I saw a forum question that asked how to OCR non selectable text from a screen and get its coordinates. This intrigued me, as I would like to have this ability in my scripts. I found the following VB code and I am having difficulty "Converting" it to Autoit code. It provides a pixel count to a rectangle around a specified word relative to the window it is in. Sub TestRects() Dim miSelectRectDoc As MODI.Document Dim miSelectRectWord As MODI.Word Dim miSelectRectRects As MODI.MiRects Dim miSelectRectRect As MODI.MiRect Dim strRectInfo As String ' Load an existing TIFF file. Set miSelectRectDoc = New MODI.Document miSelectRectDoc.Create "C:\document1.tif" ' Perform OCR. miSelectRectDoc.Images(0).OCR ' Retrieve and display bounding rectangle information. Set miSelectRectRects = miSelectRectDoc.Images(0).Layout.Words(2).Rects strRectInfo = "Word falls within " & miSelectRectRects.Count & _ " bounding rectangle(s)." & vbCrLf For Each miSelectRectRect In miSelectRectRects strRectInfo = strRectInfo & _ " Rectangle coordinates: " & vbCrLf & _ " - Left: " & miSelectRectRect.Left & vbCrLf & _ " - Right: " & miSelectRectRect.Right & vbCrLf & _ " - Top: " & miSelectRectRect.Top & vbCrLf & _ " - Bottom: " & miSelectRectRect.Bottom Next MsgBox strRectInfo, vbInformation + vbOKOnly, _ "Rectangle Information" Set miSelectRectRect = Nothing Set miSelectRectRects = Nothing Set miSelectRectWord = Nothing Set miSelectRectDoc = Nothing End Sub I already have an OCR function that closely resembles this code. I would like to insert just the MiRect function into it. I get an error when attempting to create the MiRect and MiRects objects: Func OCR_Region($x,$y,$width,$height) ;note $height is NOT the height, it is the Y coordinate bottom right corner, width is bottom right corner X. Dim $miDoc, $Doc Dim $str Dim $oWord Dim $sArray[200] 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, False) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1) _GDIPlus_ImageSaveToFile ($hImage1, $temp) _GDIPlus_ImageDispose ($hImage1) _WinAPI_DeleteObject ($hBitmap1) $miDoc = ObjCreate("MODI.Document") ;=============================================================================== ;These two statements added for the MiRect function, they both produce an error $miSelectRectRects = ObjCreate("MODI.MiRects") $miSelectRectRect = ObjCreate("MODI.MiRect") ;============================================================================== $miDoc.Create($temp) ;MsgBox(0,"",$temp) ;this is the bitmap image which is "temp.bmp" $miDoc.Ocr($miLANG_ENGLISH, True, False) ;=============================================================================== ;These two statements added for the MiRect function, neither produce an error $miSelectRectRects = $miDoc.Images(0).Layout.Words(1).Rects $Left=$miSelectRectRects.count ;I don need ".Count", but it does something ;============================================================================== $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 Thanks for your help
-
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
MODI now works after installing Office 2007 and selecting Microsoft Office Document Imaging!! Thanks again -
-
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I got the following error: ! We intercepted a COM Error ! ! err.description is: ! err.windescription: Invalid class string ! err.number is: 800401F3 ! err.lastdllerror is: 0 ! err.scriptline is: 8 ! err.source is: ! err.helpfile is: ! err.helpcontext is: !>15:24:06 AutoIt3.exe ended.rc:123 +>15:24:06 AutoIt3Wrapper Finished. >Exit code: 123 Time: 1.513 It works ok on my win 7 laptop I ordered a full install of Office 2007 on Ebay I'll see how that goes. Thanks -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
As per Microsoft, downloading MDI to Tiff converter installs MODI: https://support.microsoft.com/en-us/topic/install-modi-for-use-with-microsoft-office-2010-4fbd3076-6d01-9cb7-c574-3bbabc9eead9 I installed it and now I get : Variable must be of type "Object" for $miDoc.Create($temp) Before installing MDI to Tiff converter I got an error on the line previous to this line ($miDoc = ObjCreate("MODI.Document") Here is the code again: Func OCR_Region($x,$y,$width,$height) ;note $height is NOT the height, it is the Y coordinate bottom right corner, width is bottom right corner X. Dim $miDoc, $Doc Dim $str Dim $oWord Dim $sArray[200] 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, False) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1) _GDIPlus_ImageSaveToFile ($hImage1, $temp) _GDIPlus_ImageDispose ($hImage1) _WinAPI_DeleteObject ($hBitmap1) $miDoc = ObjCreate("MODI.Document") $miDoc.Create($temp) ;MsgBox(0,"",$temp);this is the bitmap image which is "temp.bmp" $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 FileDelete($temp) Return $sArray EndFunc Thanks for your elp -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I found on support.microsoft.com a MODI install solution with a link to install MDI to TIFF converter. The information supplied says its compatible with Office 2010. I will try it. -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I bought office 2019 professional, I installed everything. Office Document imaging is not there. Is Office 2007 supported / work on Win 11? Thanks -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Where can I find these components or an install for it? Thanks -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
With version 3.3.16.1 the scite editor works properly. Very, odd though. The reason that I was reluctant to install the latest version is that about 5 or more years ago, I installed the newest version of Autoit and I discovered that the UDF functions Word Management, about 15 different functions, disappeared, gone. With the installation that I just did today, the functions are there. But here is a problem I am having on the win 11 laptop: I have copied over a fully functioning script from my win 7 laptop to my win 11 laptop and i find this line of code producing an error: $miDoc = ObjCreate("MODI.Document") Am I missing a dll or something? Thanks -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Do I need to uninstall everything or will the latest version just over write everything? -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I dont know how "Solution" got turned on, not solved. -
Autoit and Scite On Win 11
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I ran v14.801.2025.0-SciTE4AutoIt3.exe and ran autoit-3-3-8-1-en-win.exe on my win 11 laptop. I found these files stored away on my win 7 laptop. Would this be the full install? -
I have been using Autoit 3.3.8.1 and Scite 3.2.0 on a win 7 laptop since 2013 I just got a new laptop running Win 11 and it seems that Scite has abnormalities on my Win 11 laptop. When I start typing an existing Variable, no drop down list appears of all variables that match what I have typed so far. I am wondering if Autoit is compatible as well. Thanks for your help
-
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
$oError.ScriptLine is my solution. Thanks -
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Thanks for the code, I will try it later tomorrow. -
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I searched the help, the closest that I can find is @scriptLineNumber which is not the offending line but the line that executes the command @scriptLineNumber -
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
One last question on this. How can i get the line number that created the error? Thanks again -
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Local $oMyError = ObjEvent("AutoIt.Error", MyErrFunc) This produces : ERROR: sytax error Local $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") This works. I put a return 0 so that the script can continue. Thanks a bunch. -
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I did a test script where I provided a "Box" where the screen was blank, no text. The OCR_Region function always failed. When I provided a "Box" where text exists, it always returns an array of text, and rather quickly. The text is always correct. There are no "1" confused with lower case L, etc..... I'll try the trap idea you suggested. -
Cant trap error in Custom function - (Moved)
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
I really dont know what the type of error it is. The script simply stops at the offending statement. Is this your suggestion? Local $oMyError = ObjEvent("AutoIt.Error", MyErrFunc) func MyErrFunc() msgbox(0,'','There was an error in the OCR_Region function') Exit endfunc -
I found this OCR code a long time ago, it really work great , When there is text to capture. The problem is that when there is no text, or the text is too close to the defined boundary, it fails and the script just stops. The code line that fails is $miDoc.Ocr($miLANG_ENGLISH, True, False) The console says: ==> The requested action with this object has failed.: This returns an array of captured text #include <ScreenCapture.au3> #include <Array.au3> $Array=OCR_Region(TLCx,TLCy,BRCx,BRCy) ;Top Left Corner x, Top Left Cornr y, Bottom Right Corner x, Bottom right Corner y Func OCR_Region($x,$y,$width,$height) ;note $height is NOT the height, it is the Y coordinate bottom right corner, width is bottom right corner X. If 1=2 Then Sleep(500) EndIf $OCRstart=TimerInit() Dim $miDoc, $Doc Dim $str Dim $oWord Dim $sArray[200] 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, False) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1) _GDIPlus_ImageSaveToFile ($hImage1, $temp) _GDIPlus_ImageDispose ($hImage1) _WinAPI_DeleteObject ($hBitmap1) $miDoc = ObjCreate("MODI.Document") $miDoc.Create($temp) ;MsgBox(0,"",$temp);this is the bitmap image which is "temp.bmp" $miDoc.Ocr($miLANG_ENGLISH, True, False) ;THIS LINE FAILS $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 I need to trap this error, not sure how. Thanks
-
Where is Scite 3.2.0 Help
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Are you saying that each tab in the editor can be a different language?? I think that help should just default to English if there is no specific defined language to use. This came about when installing scite not knowing what version it was. As soon as it was done installing the fist thing to do is select help to see the version. But that doesn't work. -
Where is Scite 3.2.0 Help
AutoitMike replied to AutoitMike's topic in AutoIt General Help and Support
Holy $&^%$#@!$$$%!!!! After playing with this issue for 3 days now, sequestered in my den, I have discovered the following: IF YOU HAVE A SCRIPT OPEN THAT HAS NOT BEEN SAVED, HELP DOES NOT WORK!!!! As a matter of fact, any unsaved script will not run (which I already knew) I have been using AutoIt for about 12 years, thousands of lines of code written, never discovered this.