Commands & Syntax > Commands > Window Manipulation >

Image CAPTURE from WINDOW - < win_captureimage >() ... [Pro]

www.perfectkeyboard.com

 

Window Image CAPTURE from WINDOW
<win_captureimage>("Window",Match,x,y,Width,Height,"Image file")
Available in: Professional edition

This command captures an image in defined window.

Important:

It is application specific how the window content is drawn within its window and in some cases what is visible on the computer screen as a one image is actually composed by multiple pieces. For this reason, use <display_captureimage> command if this command is not working with a particular application.

 

#

Parameter name

Parameter description

1

Window

Window identifier in form of Window Identification Path or HWND. It identifies the window where an image is to be captured.

2

Match

Takes effect only if a window is identified using WIP parameter. Can be one of these values:
0 - match substrings in WIP
1 - match exact strings in WIP

3

x

X coordination of the upper left corner of the area to be captured.

4

y

Y coordination of the upper left corner of the area to be captured.

5

Width

Width of the area to be captured. If it is set to "0" then whole window is captured.

6

Height

Height of the area to be captured.

7

Image file

Name (or full path) of the resulting image file.

 

Example (Macro Steps):

 

1

<#> <#> This macro shows how to capture picture of an active window

2

Macro execution: ONLY COMMANDS

3

Window Image CAPTURE from WINDOW Window = "_vActiveWindow_HWND", Match = "Partial", x = "0", y = "0", Width = "0", Height = "0", Image file = "%_vFolder_Personal%\WindowImage.bmp"

4

Message SHOW "Question" : "Do you want to see the captured image now?" (other parameters: x = -100, y = -100, Window title = Message, Buttons = Yes and No, Timeout (seconds) = 0, Always on top = ).

5

IF _vMsgButton==YES

6

File OPEN open file "%_vFolder_Personal%\WindowImage.bmp" in system default viewer.

7

ENDIF

Example (Plain Text):

 

<#> This macro shows how to capture picture of an active window

<cmds>

 

<win_captureimage>("_vActiveWindow_HWND",0,0,0,0,0,"%_vFolder_Personal%\WindowImage.bmp")

 

<msg>(-100,-100,"Do you want to see the captured image now?","Message",2,0,1)

 

<if>("_vMsgButton==YES")

   <fileopen>("%_vFolder_Personal%\WindowImage.bmp",0)

<endif>