Items Property

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

Use this property to obtain a Timer object stored in the TimersObj collection by the object’s index in this collection or by the object’s name.

Declaration

TimersObj.Items(Index)

Read-Only Property A Timer object
TimersObj An expression, variable or parameter that specifies a reference to a Timers object
Index [in]    Required    Variant    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

Specifies the index or name of the desired Timer object. The first object in the collection has index 0, the second - 1, etc. The total number of objects in the collection is specified by the Count property.

Property Value

The reference to the desired Timer object. If the Timers collection does not contain an object with the specified index or name, TestComplete posts an error message to the test log and returns a null Variant value.

Remarks

The names of Timer objects are not unique. Two Timer objects may have the same name. So, if you pass the name in the Index parameter, the Items property will return the “oldest”Timer object.

Example

The code below demonstrates how you can use the Utils.Timers property to obtain the Timers collection and how to obtain the desired Timer object from this collection.

JavaScript, JScript

function TestProc()
{
  // Obtains the Timers collection
  TimersCollection = Utils.Timers;

  // Obtains the first object in the Timers collection
  Timer = TimersCollection.Items(0); // Obtains a timer by its index or name
  // ...
}

Python

def TestProc():
  # Obtains the Timers collection
  TimersCollection = Utils.Timers

  # Obtains the first object in the Timers collection
  Timer = TimersCollection.Items[0] # Obtains a timer by its index or name
  # ...

VBScript

Sub TestProc
  ' Obtains the Timers collection
  Set TimersCollection = Utils.Timers

  ' Obtains the first object in the Timers collection
  Set Timer = TimersCollection.Items(0) ' Obtains a timer by its index or name
  ' ...
End Sub

DelphiScript

procedure TestProc;
var
  TimersCollection, Timer : OleVariant;
begin
  //Obtains the Timers collection
  TimersCollection := Utils.Timers;

  // Obtains the first object in the Timers collection
  Timer := TimersCollection.Items[0]; // Obtains a timer by its index or name
  // ...
end;

C++Script, C#Script

function TestProc()
{
  var TimersCollection, Timer;
  // Obtains the Timers collection
  TimersCollection = Utils["Timers"];

  // Obtains the first object in the Timers collection
    Timer = TimersCollection["Items"](0); // Obtains a timer by its index or name
  // ...
}

See Also

Using Timers
Timer Object
Name Property
Count Property
Add Method
Delete Method
Clear Method

Highlight search results