FileVersionInfo Object

Applies to TestComplete 15.0, last modified on October 14, 2021

Description

The FileVersionInfo object provides version resource information built into the executable file. To obtain the object in scripts, read the FileVersionInfo property of the desired process object.

File version information consists of four numeric parts that are delimited by dots: the major number, minor number, build number and private number. You can obtain each of them via the corresponding properties.

Members

Example

The following script demonstrates how you can obtain the version number of a process’s executable file and post this number and its individual parts to the test log:

JavaScript, JScript

function FileVerInfoSample()
{
  var verInfo = Sys.Process("TestComplete").FileVersionInfo;

  Log.Message("Version number: " + verInfo);
  Log.Message("Major: " + verInfo.MajorPart);
  Log.Message("Minor: " + verInfo.MinorPart);
  Log.Message("Build: " + verInfo.BuildPart);
  Log.Message("Private: " + verInfo.PrivatePart);
}

Python

def FileVerInfoSample():
  verInfo = Sys.Process("TestComplete").FileVersionInfo

  Log.Message("Version number: " + VarToStr(verInfo))
  Log.Message("Major: " + VarToStr(verInfo.MajorPart))
  Log.Message("Minor: " + VarToStr(verInfo.MinorPart))
  Log.Message("Build: " + VarToStr(verInfo.BuildPart))
  Log.Message("Private: " + VarToStr(verInfo.PrivatePart))

VBScript

Sub FileVerInfoSample
  Dim verInfo
  Set verInfo = Sys.Process("TestComplete").FileVersionInfo

  Log.Message "Version number: " & verInfo
  Log.Message "Major: " & verInfo.MajorPart
  Log.Message "Minor: " & verInfo.MinorPart
  Log.Message "Build: " & verInfo.BuildPart
  Log.Message "Private: " & verInfo.PrivatePart
End Sub

DelphiScript

procedure FileVerInfoSample;
var verInfo;
begin
  verInfo := Sys.Process('TestComplete').FileVersionInfo;

  Log.Message('Version number: ' + verInfo);
  Log.Message('Major: ' + VarToStr(verInfo.MajorPart));
  Log.Message('Minor: ' + VarToStr(verInfo.MinorPart));
  Log.Message('Build: ' + VarToStr(verInfo.BuildPart));
  Log.Message('Private: ' + VarToStr(verInfo.PrivatePart));
end;

C++Script, C#Script

function FileVerInfoSample()
{
  var verInfo = Sys["Process"]("TestComplete")["FileVersionInfo"];

  Log["Message"]("Version number: " + verInfo);
  Log["Message"]("Major: " + verInfo["MajorPart"]);
  Log["Message"]("Minor: " + verInfo["MinorPart"]);
  Log["Message"]("Build: " + verInfo["BuildPart"]);
  Log["Message"]("Private: " + verInfo["PrivatePart"]);
}

See Also

FileVersionInfo Property
aqFileVersionInfo Object

Highlight search results