Reset Method

Applies to TestComplete 15.48, last modified on March 01, 2023

Description

Use the Reset method to position the iterator’s pointer right before the first object. In this case, a subsequent call to Next will retrieve the first object in the collection.

Declaration

aqObjIteratorObj.Reset()

aqObjIteratorObj An expression, variable or parameter that specifies a reference to an aqObjIterator object
Result None

Applies To

The method is applied to the following object:

Result Value

None.

Example

The code below obtains the collection of the drives existing on your computer, performs some actions over the collection's elements, positions the iterator's pointer to the first element and posts the letters of all the elements to the test log.

JavaScript, JScript

function ObtainDriveLetters()
{

  // Obtains the drives collection
  var DrvCol = aqFileSystem.Drives;
  
  // Performs some actions over the collection
  
  // Positions the pointer to the first element
  DrvCol.Reset();
  
  while ( DrvCol.HasNext() )
  {
    // Obtains the first drive
    var DrvItem = DrvCol.Next();
    // Posts the drive letter to the test log
    Log.Message(DrvItem.DriveLetter);
  }
    
}

Python

def ObtainDriveLetters():
  # Obtains the drives collection
  DrvCol = aqFileSystem.Drives
  # Performs some actions over the collection
  # Positions the pointer to the first element
  DrvCol.Reset()
  while DrvCol.HasNext():
    # Obtains the first drive
    DrvItem = DrvCol.Next()
    # Posts the drive letter to the test log
    Log.Message(DrvItem.DriveLetter)

VBScript

Sub ObtainDriveLetters

  ' Obtains the drives collection
  Set DrvCol = aqFileSystem.Drives
  
  ' Performs some actions over the collection
  
  ' Positions the pointer to the first element
  DrvCol.Reset
  
  While DrvCol.HasNext
    ' Obtains the first drive
    Set DrvItem = DrvCol.Next
    ' Posts the drive letter to the test log
    Log.Message DrvItem.DriveLetter
  WEnd
    
End Sub

DelphiScript

function ObtainDriveLetters;
var DrvCol, DrvItem;
begin

  // Obtains the drives collection
  DrvCol := aqFileSystem.Drives;
  
  // Performs some actions over the collection
  
  // Positions the pointer to the first element
  DrvCol.Reset();
  
  while ( DrvCol.HasNext() ) do
  begin
    // Obtains the first drive
    DrvItem := DrvCol.Next();
    // Posts the drive letter to the test log
    Log.Message(DrvItem.DriveLetter);
  end;
    
end;

C++Script, C#Script

function ObtainDriveLetters()
{

  // Obtains the drives collection
  var DrvCol = aqFileSystem["Drives"];
  
  // Performs some actions over the collection
  
  // Positions the pointer to the first element
  DrvCol["Reset"]();
  
  while ( DrvCol["HasNext"]() )
  {
    // Obtains the first drive
    var DrvItem = DrvCol["Next"]();
    // Posts the drive letter to the test log
    Log["Message"]( DrvItem["DriveLetter"] );
  }
    
}

See Also

HasNext Method
Next Method
Skip Method

Highlight search results