CaptureArea$

Capture function.

The CaptureArea$ function captures in text mode whatever appears in the specified area of a window.

Syntax

a$=CaptureArea$(<window_name>,<instance>,<x>,<y>,<height>,<width>)

Parameters

<window_name>, window name of the window to be captured, including its <instance>, instance number of the window.

<x>,<y>, coordinates of the top-left corner of the rectangle to be captured within the specified window.

<height>,<width>, integers specifying the height and the width of the rectangle to capture.

Return value

a$, string containing the captured text. If <window_name> or <instance> are not found, or if there is nothing to capture, an empty string is returned.

Remarks

Use the Insert/Statement menu and double click CaptureArea$ in order to automatically generate this statement.

If the size of the specified area is greater than the size of the window <window_name>, the captured area is limited to the entire window.

Performance : CaptureArea$ activates a complex analysis process (0,9 second). If you need more performance, another way can be useful : select text then copy it in the clipboard (via Ctrl+C) then get its content with GetClipboard$

See also

Capture$

Example code

This script searches for *.bat files on your C: hard drive and captures the number of *.bat files.

 

UseWindow("EXPLORER.EXE|Shell_TrayWnd",1)

Click(Button,"Start")

ChooseMenu(Context,"&Find|&Files or Folders...")

 

Pause until

Text("Find Now")

InWindow("EXPLORER.EXE|Button|F&ind Now",1)

InArea(0,0,19,67)

PauseFalse

MsgBox("Pause at line " + #ErrorLine$ + " has failed !",16,"Runtime error")

End

EndPause

 

UseWindow("EXPLORER.EXE|#32770|Name && Location",1)

WriteCombo("1","*.bat")

 

UseWindow("EXPLORER.EXE|#32770|Find: All Files",1)

Click(Button,"F&ind Now")

 

Pause until

Text("file(s) found")

InWindow("EXPLORER.EXE|msctls_statusbar32",1)

PauseFalse

MsgBox("Pause at line " + #ErrorLine$ + " has failed !",16,"Runtime error")

End

EndPause

 

count$=CaptureArea$("EXPLORER.EXE|msctls_statusbar32",1,0,0,18,145)

 

msgbox(count$)

 

CloseWindow("EXPLORER.EXE|#32770|Find: Files named",1)