Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Screen Scrape Text Capture
#1
Can you add to QM next version functions to Screen Scrape Text Capture... like http://www.mjtnet.com/blog/2008/01/03/s ... re-example?
#2
Function Dialog68
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("Dialog68" &Dialog68)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x54000000 0x0 4 4 216 46 "Text"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,SetTimer hDlg 1 100 0
,
,case WM_TIMER
,sel wParam
,,case 1
,,Acc a=acc(mouse)
,,str s=a.Name; err
,,if(!s.len)
,,,s=a.Value; err
,,s.setwintext(id(3 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
Can you add the functions: GetTextAtPoint, GetTextInRect, GetWindowTextEx, WaitScreenText?
#4
You can get text of a particular accessible object. Can you give an example where getting text from whole screen or window or point or rectangle would be better?
#5
In objects like systreeview, sysheader...Dialog68 doesn't work.

The function in the "other program":

http://www.mjtnet.com/onlinehelp.htm

Quote:GetWindowTextEx>window_title,text



Retrieves visible text in the specified window. Unlike GetWindowText which works by accessing each object's published text property GetWindowTextEx uses lower level hooks to detect all text written to the screen and therefore is capable of capturing far more text.
#6
Do you want to get text from whole treeview? Then enumerating can be used.

Macro
Code:
Copy      Help
Acc a=acc("" "OUTLINE" win("" "CabinetWClass") "SysTreeView32" "" 0x1001 0 0 "first")
str s ss
rep
,s.addline(a.Name)
,a.Navigate("next"); err break
out s
#7
I want a function that extract text anywhere on the screen regardless of object, like GetTextInRect.
#8
I expected you have a particular task where you would use it.
Don't know how macro scheduler gets the text. It is different than if it would use accessible objects, but it is not OCR because does not work in some windows. Probably hooks text APIs.
#9
Does QM have a function similar to 'GetTextInRect'. If not could one be made?

Thanks.
#10
Doesn't have. Cannot be made. Will not have in the future.
#11
May i ask why this is not possible? Just out of curiousity.
Thanks
#12
Very much work etc, and i think not so useful.
#13
ok 1 good use i can think of is for something that has nor a id or can be found using html or Acc.
Sometimes there are things in windows that cant be found using them so this might help.
#14
Anyway to make something like this work for me?
Maybe a sample code to work off of...

thanks.
#15
Only scan.
#16
Found a screen text capture component that works in the same way as macro scheduler. Does not use OCR, therefore is fast and accurate. It is shareware, ie stops working after x days. Single license costs $100.

http://www.deskperience.com/screen-scra ... turex.html

Download and install. Then can use in QM. Also can be used without installation, you only have to copy all the dll files and register tcapturex.dll (eg using RegisterComComponent or type libraries dialog).

Examples.

Macro
Code:
Copy      Help
out

;captures text of active window

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
str s=t.CaptureActiveWindow
out s

Macro
Code:
Copy      Help
out

;captures text of user selected rectangle

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
int hwnd x y cx cy
if(t.CaptureInteractive(hwnd x y cx cy)) ret
str s=t.GetTextFromRect(hwnd x y cx cy)
out s
#17
Also tested this.

http://www.renovation-software.com/text ... b-sdk.html

Single license costs $30. Works with more programs, including openoffice. Could not compare speed because the evaluation version shows a message box every time.

Macro
Code:
Copy      Help
typelib TextGRABSDKLib {EFC617C2-F1EF-461B-BA5C-3FE1EE4A95F1} 3.0
out
BSTR b
TextGRABSDKLib.TextGRABSDK t._create
t.SetLicense("" "")
int h=_hwndqm
t.CaptureFromHWND(h b)
out b
#18
Ok i found this one to be the best, but when i even just put this in exe to try it, wont work.

Macro
Code:
Copy      Help
out

;captures text of user selected rectangle

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
int hwnd x y cx cy
if(t.CaptureInteractive(hwnd x y cx cy)) ret
str s=t.GetTextFromRect(hwnd x y cx cy)
out s

Any idea why it fails in exe?

This is output....

Error (RT) in "Macro3 /224"oMacro3: 0x80040203, A syntax error occurred trying to evaluate a query string
Capture timeout.

It highlights this...

str s=t.GetTextFromRect(hwnd x y cx cy)


Thanks!
#19
Don't know what it means. Here works well in exe.

Are you using Vista? Now I cannot test because UAC turned off, but I think these components would not work with windows of admin programs if exe is running not as admin (in QM works because it is running as admin). Try to run QM as User (set it in Options) and then run the macro in QM. If this is the reason, the macro will fail too.
#20
Where is run QM as user located in options? I can't find it.
#21
General.

Only in QM 2.3.0 and later.
#22
No, better try with another window that is not admin. Then should work. For example QM by default runs as admin and te exe macro will probably will not work with it. Try with eg notepad. Or run exe as admin, then should work with all windows.
#23
Ok i fixed that to work.
Thanks.
#24
Why doesn't work:

out

;captures text of mouse point

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
POINT p; xm(p)
int x y hwnd=win(p.x p.y)
str b=t.GetTextFromPoint(hwnd p.x p.y)
out b
#25
I cannot test but probably because p is in screen coordinates and the function needs window coordinates, maybe client.
#26
This code neither works:

out

;captures text of mouse point

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
int hwnd=win(mouse)
POINT p; xm(p hwnd 1)

str b=t.GetTextFromPoint(hwnd p.x p.y)
out b
#27
Macro
Code:
Copy      Help
out

;captures text of mouse point

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
int hwnd=child(mouse); if(!hwnd) hwnd=win(mouse)
POINT p; xm(p)
str b=t.GetTextFromPoint(hwnd p.x p.y)
out b
#28
Thank you very much.
#29
Macro
Trigger F6     Help - how to add the trigger to the macro
Code:
Copy      Help
out

;captures text of user selected rectangle

typelib TCaptureXLib {92657C70-D31B-4930-9014-379E3F6FB91A} 1.1
TCaptureXLib.TextCaptureX t._create
int hwnd x y cx cy
if(t.CaptureInteractive(hwnd x y cx cy)) ret
str s=t.GetTextFromRect(hwnd x y cx cy)
out s

How come this does not work anymre...

errors at, if(t.CaptureInteractive(hwnd x y cx cy)) ret
saying..

Error (RT) in Macro: 0x80040201, An event was unable to invoke any of the subscribers
#30
Isn't full error

Error (RT) in Macro335: 0x80040201, An event was unable to invoke any of the subscribers
Trial version expired. Please activate the library.

?
The first line error description is incorrect.


Forum Jump:


Users browsing this thread: 2 Guest(s)