aqEnvironment.GetWinMajorVersion Method

Applies to TestComplete 14.20, last modified on September 11, 2019

Description

Use the GetWinMajorVersion method to determine the major version of the operating system that is installed on your computer and is currently running.

Declaration

aqEnvironment.GetWinMajorVersion()

Result Integer

Applies To

The method is applied to the following object:

Result Value

One of the following values:

Value Description
5 Windows XP, Windows Server 2003 or Windows Embedded 2009
6 Windows Vista, Windows 7, Windows Server 2008 or later operating systems
10 Windows 10, Windows Server 2016 or Windows Server 2019

Example

The following code demonstrates how you can obtain additional information about the operating system you are currently using.

JavaScript, JScript

function OSInformation()
{
 // Gets additional information about your operating system
 var AddInfo = aqEnvironment.GetWinAdditionalInfo();
 Log.Message("You are using Microsoft Windows operating system with the " + AddInfo + " installed");

 // Gets information about your operating system's major version
 var MajVer = aqEnvironment.GetWinMajorVersion();
 // Gets information about your operating system's minor version
 var MinVer = aqEnvironment.GetWinMinorVersion();
 // Gets information about your operating system's build number
 var Build = aqEnvironment.GetWinVersionBuild();
 // Posts the information about your system to the test log
 Log.Message("The OS version you are using is " + MajVer + "." + MinVer + "." + Build );
}

Python

def OSInformation():
  # Gets additional information about your operating system
  AddInfo = aqEnvironment.GetWinAdditionalInfo()
  Log.Message("You are using Microsoft Windows operating system with the " + AddInfo + " installed")
  # Gets information about your operating system's major version
  MajVer = aqEnvironment.GetWinMajorVersion()
  # Gets information about your operating system's minor version
  MinVer = aqEnvironment.GetWinMinorVersion()
  # Gets information about your operating system's build number
  Build = aqEnvironment.GetWinVersionBuild()
  # Posts the information about your system to the test log
  Log.Message("The OS version you are using is " + str(MajVer) + "." + str(MinVer) + "." + str(Build) )

VBScript

Sub OSInformation


 ' Gets additional information about your operating system
 AddInfo = aqEnvironment.GetWinAdditionalInfo()
 Call Log.Message("You are using Microsoft Windows operating system with the " + AddInfo + " installed")

 ' Gets information about your operating system's major version
 MajVerNum = aqEnvironment.GetWinMajorVersion()
 ' Converts the version number to a string
 MajVerStr = aqConvert.IntToStr(MajVerNum)

 ' Gets information about your operating system's minor version
 MinVerNum = aqEnvironment.GetWinMinorVersion()
 ' Converts the version number to a string
 MinVerStr = aqConvert.IntToStr(MinVerNum)

 ' Gets information about your operating system's build number
 BuildNum = aqEnvironment.GetWinVersionBuild()
 ' Converts the build number to a string
 BuildStr = aqConvert.IntToStr(BuildNum)

 ' Posts the information about your system to the test log
 Call Log.Message("The OS version you are using is " + MajVerStr + "." + MinVerStr + "." + BuildStr)

End Sub

DelphiScript

function OSInformation;
var AddInfo, MajVerNum, MajVerStr, MinVerNum, MinVerStr, BuildNum, Buildstr;
begin

 // Gets additional information about your operating system
 AddInfo := aqEnvironment.GetWinAdditionalInfo();
 Log.Message('You are using Microsoft Windows operating system with the ' + AddInfo + ' installed');

 // Gets information about your operating system's major version
 MajVerNum := aqEnvironment.GetWinMajorVersion();
 // Converts the version number to a string
 MajVerStr := aqConvert.IntToStr(MajVerNum);
 // Gets information about your operating system's minor version
 MinjVerNum := aqEnvironment.GetWinMinorVersion();
 // Converts the version number to a string
 MinVerStr := aqConvert.IntToStr(MinVerNum);
 // Gets information about your operating system's build number
 BuildNum := aqEnvironment.GetWinVersionBuild();
 // Converts the build number to a string
 BuildStr := aqConvert.IntToStr(BuildNum);
 // Posts the information about your system to the test log
 Log.Message('The OS version you are using is ' + MajVerStr + '.' + MinVerStr + '.' + BuildStr);

end;

C++Script, C#Script

function OSInformation()
{
 // Gets additional information about your operating system
 var AddInfo = aqEnvironment["GetWinAdditionalInfo"]();
 Log["Message"]("You are using Microsoft Windows operating system with the " + AddInfo + " installed");

 // Gets information about your operating system's major version
 var MajVer = aqEnvironment["GetWinMajorVersion"]();
 // Gets information about your operating system's minor version
 var MinVer = aqEnvironment["GetWinMinorVersion"]();
 // Gets information about your operating system's build number
 var Build = aqEnvironment["GetWinVersionBuild"]();
 // Posts the information about your system to the test log
 Log["Message"]("The OS version you are using is " + MajVer + "." + MinVer + "." + Build );
}

See Also

aqEnvironment.GetWinMinorVersion Method
aqEnvironment.GetWinAdditionalInfo Method
aqEnvironment.GetWinVersionBuild Method
Version Property

Highlight search results