humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
set_current_language
set_current_language($language); - данная функция используется для эмуляции изменения текущего языка ввода на уровне железа для заданного окнаФункция на вход принимает параметры:
("RU" или "ru" - русский, "EN" или "en" - английский) (string). (До весрии 4.9.22)
("English","Russian","Ukranian","Greek","Arabic","Bulgarian","Catalan","Chinese (PRC)","Czech","Danish","Dutch","Finnish","French","German","Hebrew","Hungarian","Hungarian","Italian","Japanese","Korean","Lithuanian","Norwegian","Polish","Portuguese","Slovak","Spanish","Swedish","Thai","Turkish") (начиная с версии 4.9.22)
После отработки функция возвращает результат своей работы в скрипт :
Пример использования
<?php $xhe_host = "localhost:7010"; if (!isset($path)){ // Path to the init.php file for connecting to the XHE API $path = "../../../Templates/init.php"; // Including init.php grants access to all classes and functionality for working with the XHE API require($path); } // Scenario: Set current language for keyboard input in Notepad application // Step: Get the Notepad window interface $windowText = "Notepad"; $visibly = false; $notepadWindow = WINDOW::$window->get_by_text($windowText, $visibly); // Example 1: Check if Notepad window exists echo "Example 1: Check if Notepad window exists\n"; $existsResult = $notepadWindow->is_exist(); if ($existsResult) { echo "Notepad window exists\n"; } else { echo "Notepad window does not exist\n"; } // Example 2: Set language to English and input text echo "Example 2: Set language to English and input text\n"; $language1 = "en"; $setLanguageResult1 = $notepadWindow->set_current_language($language1); if ($setLanguageResult1) { echo "Language set to English successfully\n"; } else { echo "Failed to set language to English\n"; } $text1 = "abcd"; $keyResult1 = $notepadWindow->key($text1, true); if ($keyResult1) { echo "English text input successfully\n"; } else { echo "Failed to input English text\n"; } sleep(1); // Example 3: Set language to Russian and input text echo "Example 3: Set language to Russian and input text\n"; $language2 = "ru"; $setLanguageResult2 = $notepadWindow->set_current_language($language2); if ($setLanguageResult2) { echo "Language set to Russian successfully\n"; } else { echo "Failed to set language to Russian\n"; } $text2 = "абвгд"; $keyResult2 = $notepadWindow->key($text2); if ($keyResult2) { echo "Russian text input successfully\n"; } else { echo "Failed to input Russian text\n"; } sleep(1); // Quit the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7010" from xweb_human_emulator import * # начало echo("<hr><font color=blue>windowinterface.xxxxxxxxx</font><hr>") # 1 echo("1. Получим окно навигации : ") navigate=window.get_by_text("XWeb").get_child_by_number(0).get_child_by_number(0).get_child_by_number(0).get_child_by_number(2).get_child_by_number(0).get_child_by_number(0).get_child_by_number(0).get_child_by_number(1).get_child_by_number(0) echo(navigate.is_exist(),"<br>") # 2 echo("2. Введем на английском языке : ") echo(navigate.set_current_language("en")) echo(navigate.key(65)," ") echo(navigate.key(66),"<br>") sleep(1) # 3 echo("3. Введем на русском языке : ") navigate.set_current_language("ru") echo(navigate.key(65)," ") echo(navigate.key(66),"<br>") sleep(1) # конец echo("<hr><br>") # Quit app.quit()
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program:XHEScript { static void Main(string[] args) { // init XHE server = "localhost:7010"; InitXHE(); // начало echo("<hr><font color=blue>windowinterface.set_current_language</font><hr>"); // 1 шаг echo("1. Получим окно навигации : "); XHEWindowInterface navigate=window.get_by_text("XWeb",false).get_child_by_number(0).get_child_by_class("XTPToolBar").get_child_by_class("RichEdit"); echo(navigate.is_exist()+"<br>"); // 2 шаг echo("2. Введем на английском языке : "); echo(navigate.set_current_language("en")+" "); echo(navigate.key(65)+" "+navigate.key(66)+"<br>");sleep(1); // 3 шаг echo("3. Введем на русском языке : "); echo(navigate.set_current_language("ru")+" "); echo(navigate.key(65)+" "+navigate.key(66)+"<br>");sleep(1); // конец echo("\n\n"); app.quit(); } }
// подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7010"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>windowinterface.set_current_language</font><hr>"); // 1 шаг echo("1. Получим окно навигации : "); navigate=window.get_by_text("XWeb",false).get_child_by_number(0).get_child_by_class("XTPToolBar").get_child_by_class("RichEdit"); echo(navigate.is_exist()+"<br>"); // 2 шаг echo("2. Введем на английском языке : "); echo(navigate.set_current_language("en")+" "); echo(navigate.key(65)+" "+navigate.key(66)+"<br>"); browser.sleep(1); // 3 шаг echo("3. Введем на русском языке : "); echo(navigate.set_current_language("ru")+" "); echo(navigate.key(65)+" "+navigate.key(66)+"<br>"); browser.sleep(1); // конец echo("\n"); // Quit app.quit();
=============================================
Window Interface Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.