Regions.GetPicture Method

Applies to TestComplete 15.63, last modified on April 10, 2024

Description

The Regions.GetPicture method lets you obtain the image that is referred to by the specified item of the Regions collection.

Declaration

Regions.GetPicture(Item)

Item [in]    Required    Variant    
Result A Picture object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Item

The unique name or index of the Regions collection's item that refers to the desired image.

Result Value

The Picture object that represents the image to which the specified item of the Regions collection refers.

Example

The following example obtains the image stored in the Regions collection and then searches for this image under the cursor within a rectangle of your application’s window.

JavaScript

function Test()
{
  var Pict, StoredPict;
  
  // Obtains one of the images
  Pict = Sys.Desktop.PictureUnderMouse(20, 20, false);
  
  // Obtains another image
  StoredPict = Regions.GetPicture("StoredImageName");
  
  if (strictEqual(Pict.Find(StoredPict), null))
    Log.Warning("Not found");
}

JScript

function Test()
{
  var Pict, StoredPict;
  
  // Obtains one of the images
  Pict = Sys.Desktop.PictureUnderMouse(20, 20, false);
  
  // Obtains another image
  StoredPict = Regions.GetPicture("StoredImageName");
  
  if (Pict.Find(StoredPict) == null)
    Log.Warning("Not found");
}

Python

def Test():
  # Obtains one of the images
  Pict = Sys.Desktop.PictureUnderMouse[20, 20, False]
  # Obtains another image
  StoredPict = Regions.GetPicture("StoredImageName")
  if Pict.Find(StoredPict) == None:
    Log.Warning("Not found")

VBScript

Sub Test
  ' Obtains one of the images
  Set Pict = Sys.Desktop.PictureUnderMouse(20, 20, False)
  
  ' Obtains the stored image
  Set StoredPict = Regions.GetPicture("StoredImageName")
  
  If Pict.Find(StoredPict) Is Nothing Then
    Log.Warning "Not found"
  End If
End Sub

DelphiScript

procedure Test;
var
  Pict, StoredPict : OleVariant;
begin
  // Obtains one of the images
  Pict := Sys.Desktop.PictureUnderMouse(20, 20, False);
  
  // Obtains stored image
  StoredPict := Regions.GetPicture('StoredImageName');
  
  if ( Pict.Find(StoredPict) = nil ) then
    Log.Warning('Not found');
end;

C++Script, C#Script

function Test()
{
  var Pict, StoredPict;
  
  // Obtains one of the images
  Pict = Sys["Desktop"]["PictureUnderMouse"](20, 20, false);
  
  // Obtains stored image
  StoredPict = Regions["GetPicture"]("StoredImageName");
  
  if (Pict["Find"](StoredPict) == null)
    Log["Warning"]("Not found");
}

See Also

About Regions Collection
Add Method
AddPicture Method
Remove Method
Picture Object

Highlight search results