Version Property

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

Description

Use the OSInfo.Version property to get the version of the installed operating system.

Declaration

OSInfoObj.Version

Read-Only Property String
OSInfoObj An expression, variable or parameter that specifies a reference to an OSInfo object

Applies To

The property is applied to the following object:

Property Value

The string that represents the version of the operating system.

Remarks

To get individual parts of the operating system’s version number, use the aqEnvironment.GetWinMajorVersion, aqEnvironment.GetWinMinorVersion and aqEnvironment.GetWinVersionBuild methods.

Example

The following example obtains information on the operating system and posts it to the test log.

JavaScript, JScript

function OSInfoSample()
{
  var OSInfo = Sys.OSInfo;

  // Obtains information on the running operating system
  var Info = "Name: " + OSInfo.Name + " ";

  if (OSInfo.Windows64bit)
    Info += "64-bit version" + "\r\n";
  else
    Info += "32-bit version" + "\r\n";

  Info += "Edition: " + OSInfo.Edition + "\r\n" +
        "Service Pack Version: " + OSInfo.ServicePackVersion + "\r\n" +
        "Version: " + OSInfo.Version;

  // Posts the information to the test log
  Log.Message("Operating system information:", Info);
}

Python

def OSInfoSample():
  OSInfo = Sys.OSInfo
  
  # Obtains information on the running operating system
  Info = "Name: " + OSInfo.Name + " "
  
  if OSInfo.Windows64bit:
    Info = Info + "64-bit version" + "\r\n"
  else:
    Info = Info + "32-bit version" + "\r\n"
  
  Info = Info + "Edition: " + OSInfo.Edition + "\r\n" +\
    "Service Pack Version: " + OSInfo.ServicePackVersion + "\r\n" +\
    "Version: " + OSInfo.Version
  
  # Posts the information to the test log
  Log.Message("Operating system information:", Info)

VBScript

Sub OSInfoSample
  Dim OSInfo, Info
  Set OSInfo = Sys.OSInfo

  ' Obtains information on the running operating system
  Info = "Name: " & OSInfo.Name & " "

  If OSInfo.Windows64bit Then
    Info = Info & "64-bit version" & vbNewLine
  Else
    Info = Info & "32-bit version" & vbNewLine
  End If

  Info = Info & "Edition: " & OSInfo.Edition & vbNewLine & _
        "Service Pack Version: " & OSInfo.ServicePackVersion & vbNewLine & _
        "Version: " & OSInfo.Version

  ' Posts the information to the test log
  Log.Message "Operating system information:", Info
End Sub

DelphiScript

procedure OSInfoSample;
var OSInfo, Info;
begin
  OSInfo := Sys.OSInfo;

  // Obtains information on the running operating system
  Info := 'Name: ' + OSInfo.Name + ' ';

  if OSInfo.Windows64bit then
    Info := Info + '64-bit version' + #13#10
  else
    Info := Info + '32-bit version' + #13#10;

  Info := Info + 'Edition: ' + OSInfo.Edition + #13#10 +
        'Service Pack Version: ' + OSInfo.ServicePackVersion + #13#10 +
        'Version: ' + OSInfo.Version;

  // Posts the information to the test log
  Log.Message('Operating system information:', Info);
end;

C++Script, C#Script

function OSInfoSample()
{
  var OSInfo = Sys["OSInfo"];

  // Obtains information on the running operating system
  var Info = "Name: " + OSInfo["Name"] + " ";

  if (OSInfo["Windows64bit"])
    Info += "64-bit version" + "\r\n";
  else
    Info += "32-bit version" + "\r\n";

  Info += "Edition: " + OSInfo["Edition"] + "\r\n" +
        "Service Pack Version: " + OSInfo["ServicePackVersion"] + "\r\n" +
        "Version: " + OSInfo["Version"];

  // Posts the information to the test log
  Log["Message"]("Operating system information:", Info);
}

See Also

FullName Property
Name Property
Edition Property
Windows64bit Property
ServicePackVersion Property
MediaCenter Property
TabletPC Property
GetWinMajorVersion Method
GetWinMinorVersion Method
GetWinVersionBuild Method

Highlight search results