Files Object Methods

Applies to TestComplete 15.20, last modified on January 19, 2022

The Files object contains the following methods:

Method List

Name Description
Add Adds the specified file to the Files collection and assigns a name to it. Returns True if the file was added successfully; otherwise, it returns False.
CalculateHashValue Calculates and returns an integer value that indicates the difference between two files. You can use the resulting value to specify the acceptable level of the difference.
Note: This method is obsolete and supported for backward compatibility only. To retrieve the value of the difference between two files, use the LastError method that is called after the file comparison fails.
Compare Returns True if the files are identical, otherwise, it returns False. Also this method lets you update the stored file with the specified one.
Contains Returns True if the Files collection contains the item with the specified name and False otherwise.
ContainsFile Returns True if the Files collection contains the file with the specified name and False otherwise.
Count Returns the number of items in the Files collection.
CreateEmpty Creates a new file on the disk and adds it to the Files collection as a new collection item. Returns True if the file was created and added successfully; otherwise, it returns False.
FileNameByIndex Returns the name of the file stored in the Files collection as an item with the specified index.
FileNameByName Returns the name of the file stored in the Files collection as an item with the specified name.
FileNamesList Lists the names of files stored in the Files collection as a string in which individual file names are separated by line breaks (0x13, 0x10) by default.
Items Returns the specified item stored in the Files collection.
LastError Returns text of the last error generated by the object’s methods; for example: “File not found”, “Properties are not equal”, etc.
NameByFileName Returns the item name under which the specified file is stored in the Files collection.
NameByIndex Returns the name of the item with the index specified in the Files collection.
NamesList Lists the names of items stored in the Files collection as a string in which individual item names are separated by line breaks (0x13, 0x10) by default.
Remove Removes the specified item from the Files collection. Returns True if the item was deleted successful and False otherwise.

See Also

Files Object

Highlight search results