CodePage Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

A file can contain multiple version information blocks translated in different languages. The CodePage property lets you get the code page identifier of a particular version information block. To get the language of the appropriate version information translation, use the Language property.

Declaration

aqFileVersionInfoObj.CodePage(Index)

Read-Only Property Integer
aqFileVersionInfoObj An expression, variable or parameter that specifies a reference to an aqFileVersionInfo object
Index [in]    Optional    Integer Default value: 0   

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

A zero-based index of the desired version information block. Default is 0. To get the total number of version information translations in the file, use the Languages property.

Property Value

The code page identifier of the specified version information block. For example, 1252 stands for Windows ANSI code page. For a full list of available identifiers, see the Code Page Identifiers article in the MSDN library.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the CodePage property in square brackets: CodePage[Index].

Example

The following example posts information about Notepad’s version information translations to the test log:

JavaScript, JScript

function VersionInfoSample()
{
  var FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe";
  var VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo;

  for (var i = 0; i < VerInfo.Languages; i++)
    Log.Message("Language: " + VerInfo.Language(i) + ", Code page: " + VerInfo.CodePage(i));
  Log.Message("Total number of languages: " + VerInfo.Languages);
}

Python

def VersionInfoSample():
  FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe"
  VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo
  for i in range(0, VerInfo.Languages):
    Log.Message("Language: " + VerInfo.Language[i] + ", Code page: " + str(VerInfo.CodePage[i]))
  Log.Message("Total number of languages: " + str(VerInfo.Languages))

VBScript

Sub VersionInfoSample
  Dim FileName, VerInfo, i

  FileName = Sys.OSInfo.WindowsDirectory & "\notepad.exe"
  Set VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo

  For i = 0 To VerInfo.Languages - 1
    Log.Message "Language: " & VerInfo.Language(i) & ", Code page: " & VerInfo.CodePage(i)
  Next
  Log.Message "Total number of languages: " & VerInfo.Languages
End Sub

DelphiScript

procedure VersionInfoSample;
var FileName, VerInfo, i;
begin
  FileName := Sys.OSInfo.WindowsDirectory + '\notepad.exe';
  VerInfo := aqFileSystem.GetFileInfo(FileName).VersionInfo;

  for i := 0 to VerInfo.Languages - 1 do
    Log.Message('Language: ' + VerInfo.Language[i] + ', Code page: ' + VerToStr(VerInfo.CodePage[i]));
  Log.Message('Total number of languages: ' + VarToStr(VerInfo.Languages));
end;

C++Script, C#Script

function VersionInfoSample()
{
  var FileName = Sys["OSInfo"]["WindowsDirectory"] + "\\notepad.exe";
  var VerInfo = aqFileSystem["GetFileInfo"](FileName)["VersionInfo"];

  for (var i = 0; i < VerInfo["Languages"]; i++)
    Log["Message"]("Language: " + VerInfo["Language"](i) + ", Code page: " + VerInfo["CodePage"](i));
  Log["Message"]("Total number of languages: " + VerInfo["Languages"]);
}

See Also

Language Property
Languages Property

Highlight search results