SerialNumber Property

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

Description

Use the SerialNumber property to obtain a decimal number that uniquely identifies a disk volume.

Declaration

aqDriveInfoObj.SerialNumber

Read-Only Property Double
aqDriveInfoObj An expression, variable or parameter that specifies a reference to an aqDriveInfo object

Applies To

The property is applied to the following object:

Property Value

The serial number of a disk.

Example

The code below demonstrates how to obtain the serial numbers of all the drives installed on your computer.

JavaScript, JScript

function DriveSerialNumbersExample()
{
 var Fixed = 3;
 for (i = 0; i != aqFileSystem.Drives.Count; i++)
 {
 if (aqFileSystem.Drives(i).DriveType == Fixed)
  Log.Message("The serial number of the " + aqFileSystem.Drives(i).DriveLetter + " drive is: " + aqFileSystem.Drives(i).SerialNumber);
 }
}

Python

def DriveSerialNumbersExample():
  Fixed = 3
  for i in range(0, aqFileSystem.Drives.Count):
    if (aqFileSystem.Drives.Item(i).DriveType == Fixed):
      Log.Message("The serial number of the " + aqFileSystem.Drives.Item(i).DriveLetter + " drive is: " + str(aqFileSystem.Drives.Item(i).SerialNumber))

VBScript

Sub DriveSerialNumberExample
 Dim i, Fixed
 Fixed = 3
 For i = 0 to aqFileSystem.Drives.Count - 1
  If aqFileSystem.Drives(i).DriveType = Fixed Then
   Call Log.Message("The serial number of the " + aqFileSystem.Drives(i).DriveLetter + " drive is: " + aqFileSystem.Drives(i).SerialNumber)
  End If
 Next
End Sub

DelphiScript

function DriveSerialNumberExample;
var i, Fixed: integer;
begin
 Fixed := 3;
 for i :=0 to aqFileSystem.Drives.Count-1 do
 begin
  If (aqFileSystem.Drives(i).DriveType = Fixed) Then
   Log.Message('The serial number of the ' + aqFileSystem.Drives(i).DriveLetter + ' drive is: ' + aqFileSystem.Drives(i).SerialNumber);
 end;
end;

C++Script, C#Script

function DriveSerialNumberExample()
{
 Fixed = 3;
 for (i = 0; i != aqFileSystem["Drives"]["Count"]; i++)
 {
 if (aqFileSystem["Drives"](i)["DriveType"] == Fixed)
  {
   Log["Message"]( "The serial number of the " + aqFileSystem["Drives"](i)["DriveLetter"] + " drive is: " + aqFileSystem["Drives"](i)["SerialNumber"] );
  }
 }
}

See Also

Working With Files From Scripts
GetDriveInfo Method
DriveLetter Property

Highlight search results