Picture Method

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

The Picture method captures the image of the rectangular area specified by the RegionInfo object and returns the Picture object that provides a scripting interface to the captured image.

Declaration

RegionInfoObj.Picture()

RegionInfoObj An expression, variable or parameter that specifies a reference to a RegionInfo object
Result A Picture object

Applies To

The method is applied to the following object:

Result Value

The Picture object that represents the captured image of the tested object’s rectangular area.

Example

The code below demonstrates how to use the RegionInfo object to capture the image of the area of the tested application’s window:

JavaScript, JScript

function Test()

{

  // Specifies the rectangular area of the tested application's window
  var wnd = Sys.Process("notepad").Window("Notepad", "*");
  var reg = Regions.CreateRegionInfo(wnd, 5, 5, 200, 50, false);

  // Captures the image of the specified area
  var pic = reg.Picture();

  …

}

Python

def Test():
  # Specifies the rectangular area of the tested application's window 
  wnd = Sys.Process("notepad").Window("Notepad", "*");
  reg = Regions.CreateRegionInfo(wnd, 5, 5, 200, 50, False)
  # Captures the image of the specified area 
  pic = reg.Picture()
  # ...

VBScript

Sub Test

  ' Specifies the rectangular area of the tested application's window
  Set wnd = Sys.Process("notepad").Window("Notepad", "*")
  Set reg = Regions.CreateRegionInfo(wnd, 5, 5, 200, 50, False)

  ' Captures the image of the specified area
  Set pic = reg.Picture()

  …

End Sub

DelphiScript

procedure Test();
var wnd, reg, pic: OleVariant;
begin

  // Specifies the rectangular area of the tested application's window
  wnd := Sys.Process('notepad').Window('Notepad', '*');
  reg := Regions.CreateRegionInfo(wnd, 5, 5, 200, 50, false);

  // Captures the image of the specified area
  pic := reg.Picture();

  …

end;

C++Script, C#Script

function Test()

{

  // Specifies the rectangular area of the tested application's window
  var wnd = Sys["Process"]("notepad")["Window"]("Notepad", "*");
  var reg = Regions["CreateRegionInfo"](wnd, 5, 5, 200, 50, false);

  // Captures the image of the specified area
  var pic = reg["Picture"]();

  …

}

See Also

RegionInfo Object
Picture Method
About Region Checkpoints

Highlight search results