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:
-
The
FileMajorVersion
,FileMinorVersion
,FileBuildVersion
,FileRevisionVersion
andFileFullVersion
properties indicate the file version. -
The
ProductName
,ProductMajorVersion
,ProductMinorVersion
,ProductBuildVersion
,ProductRevisionVersion
andProductFullVersion
properties provide information about the product that the file is associated with. -
The
CompanyName
property indicates the file’s manufacturer. -
The
FileType
andFileSubType
properties indicate the file type. -
The
FileFlags
property holds the module attributes (private build, special build and others). -
The
FileDescription
andComments
properties return additional information about the file. -
The
Languages
,Language
andCodePage
properties provide information about languages of the version information built into the file.
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"]);
}