Files.Items Method

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

The Files.Items method lets you obtain the File object that provides a scripting interface to an item of the Files collection.

Declaration

Files.Items(FileName)

FileName [in]    Required    String    
Result A File object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

FileName

The unique name of the desired item in the collection. Item names are shown in the Name column of the Files editor.

Result Value

The File object that corresponds to the item with the given name.

Remarks

If the specified item does not exist, an error will occur. To check whether the specified item belongs to the collection, use the Contains method.

Example

The following example demonstrates how you can access the specified item stored in the Files collection and then check whether the file stored by this item and an external file are identical.

JavaScript, JScript

StoredFile = Files.Items("OrderList_old");
if (! StoredFile.Check("C:\\Work\\OrdersList.txt") )
  Log.Warning("List of orders was changed");

Python

StoredFile = Files.Items("OrderList_old")
if not StoredFile.Check("C:\\Work\\OrdersList.txt"):
  Log.Warning("List of orders was changed")

VBScript

Set StoredFile = Files.Items("OrderList_old")
If Not StoredFile.Check("C:\Work\OrdersList.txt") Then
  Log.Warning("List of orders was changed")
End If

DelphiScript

StoredFile := Files.Items('OrderList_old');
if not StoredFile.Check('C:\Work\OrdersList.txt') then
  Log.Warning('List of orders was changed');

C++Script, C#Script

StoredFile = Files.Items("OrderList_old");
if (! StoredFile["Check"]("C:\\Work\\OrdersList.txt") )
  Log["Warning"]("List of orders was changed");

See Also

Add Method
Remove Method
File Object

Highlight search results