aqFileVersionInfo Object

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The aqFileVersionInfo object provides various version information about a file. To get this object in your tests, use the aqFileInfo.VersionInfo property. Note, that version information can be included only in binary files (for example, executables, DLLs and so on); text files do not have version information.

The aqFileVersionInfo object provides the following version information:

Members

Example

Below is a sample script that obtains some version information about Notepad:

JavaScript, JScript

function FileVersionInfoSample()
{
  var FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe";
  var VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo;

  Log.Message("File version: " +
              VerInfo.FileMajorVersion + "." +
              VerInfo.FileMinorVersion + "." +
              VerInfo.FileBuildVersion + "." +
              VerInfo.FileRevisionVersion);
  Log.Message("Description: " + VerInfo.FileDescription);
  Log.Message("Product: " + VerInfo.ProductName);
  Log.Message("Company: " + VerInfo.CompanyName);
}

Python

def FileVersionInfoSample():
  FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe"
  VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo
  Log.Message("File version: " + str(VerInfo.FileMajorVersion) + "." + str(VerInfo.FileMinorVersion) + "." + str(VerInfo.FileBuildVersion) + "." + str(VerInfo.FileRevisionVersion))
  Log.Message("Description: " + str(VerInfo.FileDescription[0]))
  Log.Message("Product: " + str(VerInfo.ProductName[0]))
  Log.Message("Company: " + str(VerInfo.CompanyName[0]))

VBScript

Sub FileVersionInfoSample
  Dim FileName, VerInfo

  FileName = Sys.OSInfo.WindowsDirectory & "\notepad.exe"
  Set VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo

  Log.Message "File version: " & _
              VerInfo.FileMajorVersion & "." & _
              VerInfo.FileMinorVersion & "." & _
              VerInfo.FileBuildVersion & "." & _
              VerInfo.FileRevisionVersion
  Log.Message "Description: " & VerInfo.FileDescription
  Log.Message "Product: " & VerInfo.ProductName
  Log.Message "Company: " & VerInfo.CompanyName
End Sub

DelphiScript

procedure FileVersionInfoSample;
var FileName, VerInfo;
begin
  FileName := Sys.OSInfo.WindowsDirectory + '\notepad.exe';
  VerInfo := aqFileSystem.GetFileInfo(FileName).VersionInfo;

  Log.Message('File version: ' +
              VarToStr(VerInfo.FileMajorVersion) + '.' +
              VarToStr(VerInfo.FileMinorVersion) + '.' +
              VarToStr(VerInfo.FileBuildVersion) + '.' +
              VarToStr(VerInfo.FileRevisionVersion));
  Log.Message('Description: ' + VerInfo.FileDescription);
  Log.Message('Product: ' + VerInfo.ProductName);
  Log.Message('Company: ' + VerInfo.CompanyName);
end;

C++Script, C#Script

function FileVersionInfoSample()
{
  var FileName = Sys["OSInfo"]["WindowsDirectory"] + "\\notepad.exe";
  var VerInfo = aqFileSystem["GetFileInfo"](FileName)["VersionInfo"];

  Log["Message"]("File version: " +
              VerInfo["FileMajorVersion"] + "." +
              VerInfo["FileMinorVersion"] + "." +
              VerInfo["FileBuildVersion"] + "." +
              VerInfo["FileRevisionVersion"]);
  Log["Message"]("Description: " + VerInfo["FileDescription"]);
  Log["Message"]("Product: " + VerInfo["ProductName"]);
  Log["Message"]("Company: " + VerInfo["CompanyName"]);
}

See Also

Working With Files From Scripts
VersionInfo Property

Highlight search results