Deleting Images From the Regions Collection

Applies to TestComplete 15.47, last modified on January 20, 2023

The Regions collection of the Stores project item contains images that can be used in testing. You can delete images from the collection either by using the Regions editor, or from tests.

Deleting Images in the Regions Editor

To delete an image from the Regions collection of the Stores project item:

  • Select the needed image in the Regions editor and either choose Delete from the context menu or press Del.

    Once you do this, you will be asked whether you want to remove the item from the parent item (but keep the corresponding file), or whether you want to completely delete the item file from the disk.

  • Select the action you want by pressing the Remove or Delete button.

Deleting Images From Tests

To delete an image from the Regions collection in your script or keyword test, use the Remove method of the Regions object. This method removes the specified stored image from the collection.

The following code snippet obtains the name of the item that stores the specified image file and then deletes this item from the Stores > Regions collection:

JavaScript, JScript

ImageName = Regions.NameByFileName("D:\\Data\\MyFile.txt");

// Removes the image from the project, but keeps the corresponding file on the disk.
Regions.Remove(ImageName);

Python

ImageName = Regions.NameByFileName("D:\\Data\\MyFile.txt")

# Removes the image from the project, but keeps the corresponding file on the disk.
Regions.Remove(ImageName)

VBScript

ImageName = Regions.NameByFileName("D:\Data\MyFile.txt")

' Removes the image from the project, but keeps the corresponding file on the disk.
Call Regions.Remove(ImageName)

DelphiScript

ImageName := Regions.NameByFileName('D:\Data\MyFile.txt');

// Removes the image from the project, but keeps the corresponding file on the disk.
Regions.Remove(ImageName);

C++Script, C#Script

ImageName = Regions["NameByFileName"]("D:\\Data\\MyFile.txt");

// Removes the image from the project, but keeps the corresponding file on the disk.
Regions["Remove"](ImageName);

To delete images from the Regions editor with the Remove method in your keyword tests, use the Call Object Method, Run Code Snippet or Run Script Routine operation.

See Also

About Regions Collection
About Regions Editor
Regions Object
Remove Method

Highlight search results