Skip Method

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

Description

Use the Skip method to obtain a non-successive object from the collection. The method increases the index indicating the iterator’s position by the specified number of objects and returns the object by the result index. Therefore, to obtain object n from the collection, you should call Skip(n). However, it is easier to call the Item(n) method instead. To learn the total number of objects in the collection, read the Count property.

Declaration

aqObjIteratorObj.Skip(SkipCount)

aqObjIteratorObj An expression, variable or parameter that specifies a reference to an aqObjIterator object
SkipCount [in]    Required    Integer    
Result An aqFileInfo, aqFolderInfo, aqDriveInfo, aqObjEvent, aqObjField, aqObjMethod, or aqObjProperty object.

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

SkipCount

Specifies the number the iterator’s position to be increased by.

Result Value

The type of the returned object depends on the method or property that caused the creation of aqObjIterator:

Method/Property Generator Resulting object Item Meaning
aqDriveInfo.Files aqFileInfo Information about a single file from the drive’s root.
aqDriveInfo.Folders aqFolderInfo Information about a single folder from the drive’s root.
aqFileSystem.FindFiles aqFileInfo Information about a single file matching the specified search pattern.
aqFileSystem.FindFolders aqFolderInfo Information about a single folder matching the specified search pattern.
aqFileSystem.Drives aqDriveInfo Information on one of system drives.
aqFolderInfo.Files aqFileInfo Information about a single file of the folder.
aqFolderInfo.SubFolders aqFolderInfo Information about a single subfolder of the folder.
aqObject.GetEvents aqObjEvent A description of the object’s event.
aqObject.GetFields aqObjField A description of the object’s field.
aqObject.GetMethods aqObjMethod A description of the object’s method.
aqObject.GetProperties aqObjProperty A description of the object’s property.

Example

The code below obtains the collection of the drives existing on your computer and then posts the letter of every second drive to the test log.

JavaScript, JScript

function ObtainDriveLetters()
{

  // Obtains the drives collection
  var DrvCol = aqFileSystem.Drives;
  
  while (DrvCol.HasNext() )
  {
    // Obtains the current drive
    var DrvItem = DrvCol.Next();
    // Posts the drive letter to the test log
    Log.Message(DrvItem.DriveLetter);
    // Skips one element
    DrvCol.Skip(1);
  }
    
}

Python

def ObtainDriveLetters():
  # Obtains the drives collection
  DrvCol = aqFileSystem.Drives
  while DrvCol.HasNext():
    # Obtains the current drive
    DrvItem = DrvCol.Next()
    # Posts the drive letter to the test log
    Log.Message(DrvItem.DriveLetter)
    # Skips one element
    DrvCol.Skip(1)

VBScript

Sub ObtainDriveLetters

  ' Obtains the drives collection
  Set DrvCol = aqFileSystem.Drives
  
  While DrvCol.HasNext
    ' Obtains the current drive
    Set DrvItem = DrvCol.Next
    ' Posts the drive letter to the test log
    Log.Message DrvItem.DriveLetter
    ' Skips one element
    DrvCol.Skip(1)
  WEnd
    
End Sub

DelphiScript

function ObtainDriveLetters;
var DrvCol, DrvItem;
begin

  // Obtains the drives collection
  DrvCol := aqFileSystem.Drives;
  
  while (DrvCol.HasNext() ) do
  begin
    // Obtains the current drive
    DrvItem := DrvCol.Next();
    // Posts the drive letter to the test log
    Log.Message(DrvItem.DriveLetter);
    // Skips one element
    DrvCol.Skip(1);
  end;
    
end;

C++Script, C#Script

function ObtainDriveLetters()
{

  // Obtains the drives collection
  var DrvCol = aqFileSystem["Drives"];
  
  while (DrvCol["HasNext"]() )
  {
    // Obtains the current drive
    var DrvItem = DrvCol["Next"]();
    // Posts the drive letter to the test log
    Log["Message"]( DrvItem["DriveLetter"] );
    // Skips one element
    DrvCol["Skip"](1);
  }
    
}

See Also

HasNext Method
Next Method
Reset Method
Item Method

Highlight search results