Description
The IsLanguageSupported
method is used to determine whether support for the specified language is installed on your computer.
Declaration
Applies To
The method is applied to the following object:
Parameters
The method has the following parameter:
Locale
Specifies the identifier of the desired language. For instance, the language ID of US English is 0409 (a hexadecimal number), German - 0407 (hexadecimal), French - 040C (hexadecimal), etc.
Result Value
If support for the specified language is installed on the computer, the method returns True, otherwise - False.
Example
The code below demonstrates how you can check whether the desired language is supported by your system before setting it as the current keyboard layout for the NOTEPAD process.
JavaScript, JScript
function IsLanguageSupportedExample()
{
WshShell.Run("notepad.exe", SW_NORMAL);
var wNotepad = Sys.Process("notepad");
var EditForm = wNotepad.Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1);
var USEnglish = 0x0409;
if (aqEnvironment.IsLanguageSupported(USEnglish))
{
aqEnvironment.SetKeyboardLayout(wNotepad.Id, USEnglish);
EditForm.Keys("Hello!");
}
else
{
Log.Message("The specified language is not supported.");
}
}
Python
def IsLanguageSupportedExample():
WshShell.Run("notepad.exe", SW_NORMAL)
wNotepad = Sys.Process("notepad")
EditForm = wNotepad.Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1)
USEnglish = 0x0409
if aqEnvironment.IsLanguageSupported(USEnglish):
aqEnvironment.SetKeyboardLayout(wNotepad.Id, USEnglish)
EditForm.Keys("Hello!")
else:
Log.Message("The specified language is not supported.")
VBScript
Sub IsLanguageSupportedExample
Dim wNotepad, EditForm, USEnglish
Call WshShell.Run("notepad.exe", SW_NORMAL)
Set wNotepad = Sys.Process("notepad")
Set EditForm = wNotepad.Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1)
USEnglish = &H409
If (aqEnvironment.IsLanguageSupported(USEnglish)) Then
Call aqEnvironment.SetKeyboardLayout(wNotepad.Id, USEnglish)
EditForm.Keys("Hello!!")
Else
Call Log.Message("The specified language is not supported.")
End If
End Sub
DelphiScript
function IsLanguageSupportedExample;
var wNotepad, EditForm, USEnglish;
begin
WshShell.Run('notepad.exe', SW_NORMAL);
wNotepad := Sys.Process('notepad');
EditForm := wNotepad.Window('Notepad', 'Untitled - Notepad', 1).Window('Edit', '', 1);
USEnglish := $409;
if aqEnvironment.IsLanguageSupported(USEnglish) then
begin
aqEnvironment.SetKeyboardLayout(wNotepad.Id, USEnglish);
EditForm.Keys('Hello!')
end
else
Log.Message('The specified language is not supported.');
end;
C++Script, C#Script
function IsLanguageSupportedExample()
{
WshShell.Run("notepad.exe", SW_NORMAL);
var wNotepad = Sys.Process("notepad");
var EditForm = wNotepad.Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1);
var USEnglish = 0x0409;
if (aqEnvironment.IsLanguageSupported(USEnglish))
{
aqEnvironment.SetKeyboardLayout(wNotepad.Id, USEnglish);
EditForm.Keys("Hello!");
}
else
{
Log.Message("The specified language is not supported.");
}
}
See Also
aqEnvironment.GetKeyboardLayout Method
aqEnvironment.SetKeyboardLayout Method
Keys Method
Keys Action
Simulating Keystrokes