ServicePackVersion Property

Applies to TestComplete 15.63, last modified on April 10, 2024

Description

The OSInfo.ServicePackVersion property returns the version of the operating system service pack installed on your computer.

Declaration

OSInfoObj.ServicePackVersion

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 installed service pack.

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
Version Property
MediaCenter Property
TabletPC Property
GetWinAdditionalInfo Method

Highlight search results