Jump to content

Recommended Posts

Posted

$dll_file = "TCaptureX.dll"
$Dll      = DllOpen("TCaptureX.dll")
$winhand=  WinGetHandle('')
$string  = DllCall($dll,"str","GetTextFromRect","hwnd", $winhand,"long",0,"long",0,"long",400,"long",400)
MsgBox(0,'info',$string)
DllClose($dll)

"GetTextFromRect" method captures the text from the rectangle specified (left, top,

width, height) in screen coordinates, in the window specified by hwnd.

But the above code, $string returns null

Posted

  On 1/1/2011 at 2:28 AM, 'somdcomputerguy said:

I think you're calling WinGetHandle incorrectly. You're not specifying which window to get a handle from..

Not this reason, thank you.

Posted

  On 1/1/2011 at 2:39 AM, 'Deathbringer said:

It's also a good idea to search the forum thoroughly before posting.

This post does not solve the problem, the end result of this post the same problem with my

Thank you

Posted

  On 1/1/2011 at 11:49 AM, 'JohnOne said:

Can you confirm that this "$winhand= WinGetHandle('')" causes the function to use the full desktop as its source.

HotKeySet("a", "testfunc")

$wTitle = "Notepad"

While 1
   Sleep(10)
wend

func testfunc()
    $ocr = _rectOCR($wTitle,0,0,200,200)
    MsgBox(0,"OCR", $ocr)
EndFunc

Func _rectOCR($wTitle, $rX, $rY, $rWidth, $rHeight)
    $xy = WinGetPos($wTitle)
    $Title = WinGetTitle($wTitle)
    $hwnd = Dec(StringTrimLeft(WinGetHandle($Title), 2))
    $obj = ObjCreate("TCaptureX.TextCaptureX")
    $results = $obj.GetTextFromRect($hwnd, $xy[0]+$rX, $xy[1]+$rY, $rWidth, $rHeight)
    return $results
EndFunc

This code still can not get the right result, I really need help

Posted (edited)

Add this line to top of script,

Opt("WinTitleMatchMode",  2)      ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to  -4=Nocase

This helps?

edit: Ya, what he said..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted

  On 1/1/2011 at 2:55 PM, 'somdcomputerguy said:

Add this line to top of script,

Opt("WinTitleMatchMode",  2)      ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to  -4=Nocase

This helps?

edit: Ya, what he said..

Thank you, now you can extract the text in Notepad, but still can not extract the text in IE

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...