Jump to content

Ashen

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Ashen

  1. Thanks so much! that solved the problem instantly. You've saved me many an hour of frustration
  2. Thanks for the input, UEZ, but I already tried that (and I re-tried it just now) and it still has the same results - no file is saved.
  3. Hey Guys, I am running a very simple code intended to create a screenshot of a part of my screen. My problem is that only the first screenshot I take is saved (and even that doesn't always happen), but then after I call my function for the second time the older screenshot is not over-written (and if I delete the old screenshot then no new screenshot is created). Here's my code: #include <ScreenCapture.au3> dim $sFilePath = "E:\tmp.BMP" dim $OCR_Rectangle[4] = ["760", "480", "1068", "522"] _ScreenCapture_SaveImage($sFilePath, _ScreenCapture_Capture("",$OCR_Rectangle[0], $OCR_Rectangle[1], $OCR_Rectangle[2], $OCR_Rectangle[3],False),True) I am losing hope here, guys. Any chance any of you have any idea what's going on?
  4. Just a small concern of mine about this whole deal: If, in order to use these functions, I am forced to use a DLL that I do not understand - what happens if in the future the DLL would need to be changed in order to work but no one knows how to change it? do all my scripts stop working forever?
  5. Hello dear forum members, This is my first post here so please be patient with me. My problem is fairly simple - I am capturing a certain part of the screen, and this part of the screen will sometime have text in it and sometimes it will not. The problem is that for some reason Modi crashes the program when it can't recognize any text in the image I provide it. here's the code snipet: #include <GUIConstants.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <File.au3> #include <ScreenCapture.au3> ; OCR to text function. input is the coords on the screen that need translation Func OCR_This($Top_Left_X , $Top_Left_Y , $Buttom_Right_X , $Buttom_Right_Y) Dim $miDoc Dim $oWord Dim $sArray[500] dim $sFilePath = "C:\Users\A\Desktop\tmp.tif" ; in order for OCR to happen, screenshot will be saved in this file. Const $miLANG_ENGLISH = 9 ; Initialize error handler Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") $miDoc = ObjCreate("MODI.Document") _ScreenCapture_SaveImage($sFilePath, _ScreenCapture_Capture("",$Top_Left_X,$Top_Left_Y,$Buttom_Right_X,$Buttom_Right_Y,False),True) $miDoc.Create($sFilePath) $miDoc.Ocr($miLANG_ENGLISH, False, False) $i = 0 For $oWord in $miDoc.Images(0).Layout.Words $sArray [$i] = $oWord.text $i += 1 Next Return $sArray EndFunc Func _ErrFunc($oError) ; Do anything here. ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _ "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ "err.description is: " & @TAB & $oError.description & @CRLF & _ "err.source is: " & @TAB & $oError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc ;==>_ErrFunc anyone have any idea how I can avoid the program crashing here? thanks in advance, Amir.
×
×
  • Create New...