Saving an Image to the Regions Collection

Applies to TestComplete 14.10, last modified on June 5, 2019

The following code captures a region of an active window, saves it to a BMP file and inserts this file into the Stores | Regions collection.

JavaScript, JScript

function TestProc()
{
  var w;
  w = Sys.Desktop.ActiveWindow.Picture(10, 10, 60, 60);
  Regions.AddPicture(w, "Image1_bmp");
}

Python

def TestProc():
  w = Sys.Desktop.ActiveWindow().Picture(10, 10, 60, 60)
  Regions.AddPicture(w, "Image1_bmp")

VBScript

Sub TestProc
  Set w = Sys.Desktop.ActiveWindow.Picture(10, 10, 60, 60)
  Regions.AddPicture w, "Image1_bmp"
End Sub

DelphiScript

procedure TestProc;
var
  w : OleVariant;
begin
  w := Sys.Desktop.ActiveWindow.Picture(10, 10, 60, 60);
  Regions.AddPicture(w, 'Image1_bmp');
end;

C++Script, C#Script

function TestProc()
{
  var w;
  w = Sys["Desktop"]["ActiveWindow"]["Picture"](10, 10, 60, 60);
  Regions["AddPicture"](w, "Image1_bmp");
}

Highlight search results