billymccoy Posted July 16, 2006 Posted July 16, 2006 Hello everyone. I'm trying to use TextCaptureX (http://www.deskperience.com/textcapture/) to capture text from any window automatically. I want to set my AutoIT script to call TextCaptureX DLLs, and I really don't know what I am doing wrong. The demo version comes with some examples of applications (VB, JScript, C++ etc...), and they work fine. I know that the DLLCall and ObjCreate AutoIT functions can be very tricky to use, so I still don't know if the problem is with AutoIT or with my brain. Please, if anyone is familiar with TextCaptureX and already used it along with AutoIT, give me a hand. And I would also like some other ideas for text capture softwares with API, SDK etc... Thank you!
w0uter Posted July 16, 2006 Posted July 16, 2006 How about you post the code you already have. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Moderators SmOke_N Posted July 16, 2006 Moderators Posted July 16, 2006 Is this the same ocr?http://www.structurise.com/kleptomania/index.shtml Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
billymccoy Posted July 17, 2006 Author Posted July 17, 2006 I found out. I tried ObjCreate instead of DllCall, but I also had some problems with the variable type of the window handle. Well... you asked for some code, so here you are, and working now. Thank you! ; ###################################### HotKeySet("{F5}", "GetText") HotKeySet("{F6}", "ClearText") HotKeySet("{F7}", "Close") Global $notepad Global $inicpos Run ( "notepad.exe" ) if @OSLang = 0416 then ; Portuguese - BR WinWait ( "Sem título - Bloco de notas", "" ) $notepad = WinGetHandle ( "Sem título - Bloco de notas", "" ) $close_title = "Bloco de notas" $close_text = "Deseja salvar as alterações?" elseif @OSLang = 0409 then ; English - US WinWait ( "Untitled - Notepad", "" ) $notepad = WinGetHandle ( "Untitled - Notepad", "" ) $close_title = "Notepad" $close_text = "Do you want to save the changes?" endif $inicpos = WinGetPos( $notepad ) WinMove ( $notepad, "", $inicpos[0], $inicpos[1], 400, 200 ) ControlSend ( $notepad, "", "Edit1", _ "Press F5 to capture the text" & @LF & _ "Press F6 to clear this area" & @LF & _ "Press F7 to quit the script" & @LF _ "(F7 will restore previous size)" & @LF ) while WinExists ( $notepad ) = 1 sleep ( 100 ) if WinExists ( $close_title, $close_text ) then WinMove ( $notepad, "", _ $inicpos[0], _ $inicpos[1], _ $inicpos[2], _ $inicpos[3] ) while WinExists ( $close_title, $close_text ) = 1 sleep ( 100 ) wend endif wend exit func GetText() WinActivate ( $notepad ) $pos = WinGetPos( $notepad ) $x = 6 + $pos[0] $y = 44 + $pos[1] $w = 372 $h = 114 $handle = String ( $notepad ) $handle = Int ( $handle ) $obj = ObjCreate("TCaptureX.TextCaptureX") $text = $obj.GetTextFromRect ( $handle, $x, $y, $w, $h ) ClipPut ( $text ) MsgBox ( 0, "Text", $text ) endfunc func ClearText() ControlSetText ( $notepad, "", "Edit1", "" ) endfunc func Close() WinMove ( $notepad, "", _ $inicpos[0], _ $inicpos[1], _ $inicpos[2], _ $inicpos[3] ) WinClose ( $notepad ) exit endfunc ; ######################################
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now