nacerbaaziz

Change the keyboard language in custom window

9 posts in this topic

#1 ·  Posted

Hi friends, I have a question, please.
I have created a window containing a edit box
I need to know how to change the keyboard language,
e.g :
if a user open the  script  it will be change the keyBord language   in window automatically into English
I found more examples but didn't work with me .
Note:  
 I use the windows 10 os
Please help me .
thanks in advance to all
with my Greetings and my appreciation for all users and admins

Share this post


Link to post
Share on other sites



#3 ·  Posted

Hi again.
Dear I have a query
Do I need the title of the window or window Handle
Thank you very much

Share this post


Link to post
Share on other sites

#4 ·  Posted

$hWnd = GUICreate() 
; Or
$hWnd = WinGetHandle()


_WinAPI_SetKeyboardLayout ( $hWnd, $iLanguage [, $iFlags = 0] )

;~  The input locale identifier $iLanguage:
;~ 0x0436 - Afrikaans
;~ 0x041C - Albanian
;~ 0x0401 - Arabic
;~ 0x1401 - Arabic Algeria
;~ 0x3C01 - Arabic Bahrain
;~ 0x0C01 - Arabic Egypt
;~ 0x0801 - Arabic Iraq
;~ 0x2C01 - Arabic Jordan
;~ 0x3401 - Arabic Kuwait
;~ 0x3001 - Arabic Lebanon
;~ 0x1001 - Arabic Libya
;~ 0x1801 - Arabic Morocco
;~ 0x2001 - Arabic Oman
;~ 0x4001 - Arabic Qatar
;~ 0x0401 - Arabic Saudi Arabia
;~ 0x2801 - Arabic Syria
;~ 0x1C01 - Arabic Tunisia
;~ 0x3801 - Arabic U.A.E
;~ 0x2401 - Arabic Yemen
;~ 0x042B - Armenian
;~ 0x044D - Assamese
;~ 0x082C - Azeri Cyrillic
;~ 0x042C - Azeri Latin
;~ 0x042D - Basque
;~ 0x0813 - Belgian Dutch
;~ 0x080C - Belgian French
;~ 0x0445 - Bengali
;~ 0x0416 - Portuguese (Brazil)
;~ 0x0402 - Bulgarian
;~ 0x0455 - Burmese
;~ 0x0423 - Byelorussian (Belarusian)
;~ 0x0403 - Catalan
;~ 0x0C04 - Chinese Hong Kong SAR
;~ 0x1404 - Chinese Macau SAR
;~ 0x0804 - Chinese Simplified
;~ 0x1004 - Chinese Singapore
;~ 0x0404 - Chinese Traditional
;~ 0x041A - Croatian
;~ 0x0405 - Czech
;~ 0x0406 - Danish
;~ 0x0413 - Dutch
;~ 0x0C09 - English Australia
;~ 0x2809 - English Belize
;~ 0x1009 - English Canadian
;~ 0x2409 - English Caribbean
;~ 0x1813 - English Ireland
;~ 0x2009 - English Jamaica
;~ 0x1409 - English New Zealand
;~ 0x3409 - English Philippines
;~ 0x1C09 - English South Africa
;~ 0x2C09 - English Trinidad
;~ 0x0809 - English U.K.
;~ 0x0409 - English U.S.
;~ 0x3009 - English Zimbabwe
;~ 0x0425 - Estonian
;~ 0x0438 - Faeroese
;~ 0x0429 - Farsi
;~ 0x040B - Finnish
;~ 0x040C - French
;~ 0x2C0C - French Cameroon
;~ 0x0C0C - French Canadian
;~ 0x300C - French Cote d'Ivoire
;~ 0x140C - French Luxembourg
;~ 0x340C - French Mali
;~ 0x180C - French Monaco
;~ 0x200C - French Reunion
;~ 0x280C - French Senegal
;~ 0x1C0C - French West Indies
;~ 0x240C - French Congo (DRC)
;~ 0x0462 - Frisian Netherlands
;~ 0x083C - Gaelic Ireland
;~ 0x043C - Gaelic Scotland
;~ 0x0456 - Galician
;~ 0x0437 - Georgian
;~ 0x0407 - German
;~ 0x0C07 - German Austria
;~ 0x1407 - German Liechtenstein
;~ 0x1007 - German Luxembourg
;~ 0x0408 - Greek
;~ 0x0447 - Gujarati
;~ 0x040D - Hebrew
;~ 0x0439 - Hindi
;~ 0x040E - Hungarian
;~ 0x040F - Icelandic
;~ 0x0421 - Indonesian
;~ 0x0410 - Italian
;~ 0x0411 - Japanese
;~ 0x044B - Kannada
;~ 0x0460 - Kashmiri
;~ 0x043F - Kazakh
;~ 0x0453 - Khmer
;~ 0x0440 - Kirghiz
;~ 0x0457 - Konkani
;~ 0x0412 - Korean
;~ 0x0454 - Lao
;~ 0x0426 - Latvian
;~ 0x0427 - Lithuanian
;~ 0x042F - FYRO Macedonian
;~ 0x044C - Malayalam
;~ 0x083E - Malay Brunei Darussalam
;~ 0x043E - Malaysian
;~ 0x043A - Maltese
;~ 0x0458 - Manipuri
;~ 0x044E - Marathi
;~ 0x0450 - Mongolian
;~ 0x0461 - Nepali
;~ 0x0414 - Norwegian Bokmol
;~ 0x0814 - Norwegian Nynorsk
;~ 0x0448 - Oriya
;~ 0x0415 - Polish
;~ 0x0816 - Portuguese
;~ 0x0446 - Punjabi
;~ 0x0417 - Rhaeto-Romanic
;~ 0x0418 - Romanian
;~ 0x0818 - Romanian Moldova
;~ 0x0419 - Russian
;~ 0x0819 - Russian Moldova
;~ 0x043B - Sami Lappish
;~ 0x044F - Sanskrit
;~ 0x0C1A - Serbian Cyrillic
;~ 0x081A - Serbian Latin
;~ 0x0430 - Sesotho
;~ 0x0459 - Sindhi
;~ 0x041B - Slovak
;~ 0x0424 - Slovenian
;~ 0x042E - Sorbian
;~ 0x040A - Spanish (Traditional)
;~ 0x2C0A - Spanish Argentina
;~ 0x400A - Spanish Bolivia
;~ 0x340A - Spanish Chile
;~ 0x240A - Spanish Colombia
;~ 0x140A - Spanish Costa Rica
;~ 0x1C0A - Spanish Dominican Republic
;~ 0x300A - Spanish Ecuador
;~ 0x440A - Spanish El Salvador
;~ 0x100A - Spanish Guatemala
;~ 0x480A - Spanish Honduras
;~ 0x4C0A - Spanish Nicaragua
;~ 0x180A - Spanish Panama
;~ 0x3C0A - Spanish Paraguay
;~ 0x280A - Spanish Peru
;~ 0x500A - Spanish Puerto Rico
;~ 0x0C0A - Spanish Spain (Modern Sort)
;~ 0x380A - Spanish Uruguay
;~ 0x200A - Spanish Venezuela
;~ 0x0430 - Sutu
;~ 0x0441 - Swahili
;~ 0x041D - Swedish
;~ 0x081D - Swedish Finland
;~ 0x100C - Swiss French
;~ 0x0807 - Swiss German
;~ 0x0810 - Swiss Italian
;~ 0x0428 - Tajik
;~ 0x0449 - Tamil
;~ 0x0444 - Tatar
;~ 0x044A - Telugu
;~ 0x041E - Thai
;~ 0x0451 - Tibetan
;~ 0x0431 - Tsonga
;~ 0x0432 - Tswana
;~ 0x041F - Turkish
;~ 0x0442 - Turkmen
;~ 0x0422 - Ukrainian
;~ 0x0420 - Urdu
;~ 0x0843 - Uzbek Cyrillic
;~ 0x0443 - Uzbek Latin
;~ 0x0433 - Venda
;~ 0x042A - Vietnamese
;~ 0x0452 - Welsh
;~ 0x0434 - Xhosa
;~ 0x0435 - Zulu

 


Regards,
 

Share this post


Link to post
Share on other sites

#5 ·  Posted

Hi
I tried and it didn't work with me
can you help me to set the keybord language to the english if i open this script
please

 

 

local $HWND = GUICreate("english to arabic translator", 400, 400)
GUICtrlCreateLabel("Write the English text here: ", 50, 10, 150, 60)
local $Input = GUICtrlCreateInput("", 50, 30, 200, 60)
local $Translate = GUICtrlCreateButton("&Translate", 0, 100, 50, 50, 0x01)
local $exit = GUICtrlCreateButton("&exit", 100, 100, 50, 50)


GUISetState(@sw_show, $HWND)
while 1
switch GUIGetMSG()
case $exit
exit
EndSwitch
Wend

Share this post


Link to post
Share on other sites

#6 ·  Posted

Sample scripts (Bing Translator API) for English to Arabic OR Any lanuage to Arabic Translator :

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPISys.au3>

#Region ### START GUI section ### Form=
Global $hWnd = GUICreate("English to Arabic Translator", 630, 162, -1, -1)
GUICtrlCreateLabel("Write the English text here:", 10, 2, 246, 17)
Global $eInput = GUICtrlCreateEdit("", 8, 25, 250, 100, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "Language text!")
GUICtrlCreateLabel("وقد ترجم النص إلى العربية:", 368, 2, 252, 17, $SS_RIGHT, $WS_EX_LAYOUTRTL)
Global $eOutput = GUICtrlCreateEdit("", 368, 25, 250, 100, BitOR($ES_RIGHT, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL), $WS_EX_LAYOUTRTL)
GUICtrlSetData(-1, "")
Global $bTranslate = GUICtrlCreateButton("Translate/ترجمه", 268, 25, 88, 50, $BS_DEFPUSHBUTTON)
Global $bCopy = GUICtrlCreateButton("Copy/نسخ", 268, 88, 88, 33)
Global $labStatus = GUICtrlCreateLabel("Ready!", 10, 134, 608, 21)

GUISetState(@SW_SHOW)
#EndRegion ### START GUI section ### Form=

Global Const $iLanguage = 0x0409
_WinAPI_SetKeyboardLayout($hWnd, $iLanguage)

Global $sTextToTranslated, $sTextTranslatedToArabic

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $bCopy
            $sTextToTranslated = GUICtrlRead($eOutput)
            MsgBox(64, "Copy to clipboard", ClipPut($sTextToTranslated) ? "Text translated has copy to Cliboard" : "Copy to Cliboard ERROR", Default, $hWnd)
        Case $bTranslate
            GUICtrlSetData($labStatus, "Translating...")

            GUICtrlSetData($eOutput, "")
            $sTextToTranslated = GUICtrlRead($eInput)
            $sTextTranslatedToArabic = _TranslateEnglishToArabic($sTextToTranslated)
            GUICtrlSetData($eOutput, $sTextTranslatedToArabic)

            GUICtrlSetData($labStatus, "Done!")
    EndSwitch
    Sleep(10)
WEnd

Func _TranslateEnglishToArabic($sEnglish = "")
    Local $sTranslated = BingTranslator($sEnglish, "en", "ar")
    Return $sTranslated
EndFunc   ;==>_TranslateEnglishToArabic

Func BingTranslator($sText, $sFrom = "auto", $sTo = "en")
    Local $sClient = "http://api.microsofttranslator.com/V2/Http.svc/"
    Local $appID = 'appId=68D088969D79A8B23AF8585CC83EBA2A05A97651'
    Local $Data = BinaryToString(StringToBinary($sText, 4))
    If $sFrom == "auto" Then
        $sFrom = InetRead($sClient & 'Detect?' & $appID & "&text=" & $Data, 3)
        $sFrom = StringRegExpReplace(BinaryToString($sFrom, 4), ".*>(.*)<.*", "$1")
    EndIf
    Local $Result = InetRead($sClient & 'Translate?' & $appID & "&from=" & $sFrom & "&to=" & $sTo & "&text=" & $Data, 3)
    $Result = StringRegExpReplace(BinaryToString($Result, 4), ".*>(.*)<.*", "$1")
    Return $Result
EndFunc   ;==>BingTranslator

 


Regards,
 

Share this post


Link to post
Share on other sites

#7 ·  Posted

I can not edit posts!
Forum fails with Arabic!

Script fixed:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPISys.au3>

#Region ### START GUI section ### Form=
Global $hWnd = GUICreate("English to Arabic Translator", 630, 162, -1, -1)
GUICtrlCreateLabel("Write the English text here:", 10, 2, 246, 17)
Global $eInput = GUICtrlCreateEdit("", 8, 25, 250, 100, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "Language text!")
GUICtrlCreateLabel("Arabic Text translated:", 368, 2, 252, 17, $SS_RIGHT)
Global $eOutput = GUICtrlCreateEdit("", 368, 25, 250, 100, BitOR($ES_RIGHT, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL), $WS_EX_LAYOUTRTL)
GUICtrlSetData(-1, "")
Global $bTranslate = GUICtrlCreateButton("Translate", 268, 25, 88, 50, $BS_DEFPUSHBUTTON)
Global $bCopy = GUICtrlCreateButton("Copy", 268, 88, 88, 33)
Global $labStatus = GUICtrlCreateLabel("Ready!", 10, 134, 608, 21)

GUISetState(@SW_SHOW)
#EndRegion ### START GUI section ### Form=

Global Const $iLanguage = 0x0409
_WinAPI_SetKeyboardLayout($hWnd, $iLanguage)

Global $sTextToTranslated, $sTextTranslatedToArabic

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $bCopy
            $sTextToTranslated = GUICtrlRead($eOutput)
            MsgBox(64, "Copy to clipboard", ClipPut($sTextToTranslated) ? "Text translated has copy to Cliboard" : "Copy to Cliboard ERROR", Default, $hWnd)
        Case $bTranslate
            GUICtrlSetData($labStatus, "Translating...")

            GUICtrlSetData($eOutput, "")
            $sTextToTranslated = GUICtrlRead($eInput)
            $sTextTranslatedToArabic = _TranslateEnglishToArabic($sTextToTranslated)
            GUICtrlSetData($eOutput, $sTextTranslatedToArabic)

            GUICtrlSetData($labStatus, "Done!")
    EndSwitch
    Sleep(10)
WEnd

Func _TranslateEnglishToArabic($sEnglish = "")
    Local $sTranslated = BingTranslator($sEnglish, "en", "ar")
    Return $sTranslated
EndFunc   ;==>_TranslateEnglishToArabic

Func BingTranslator($sText, $sFrom = "auto", $sTo = "en")
    Local $sClient = "http://api.microsofttranslator.com/V2/Http.svc/"
    Local $appID = 'appId=68D088969D79A8B23AF8585CC83EBA2A05A97651'
    Local $Data = BinaryToString(StringToBinary($sText, 4))
    If $sFrom == "auto" Then
        $sFrom = InetRead($sClient & 'Detect?' & $appID & "&text=" & $Data, 3)
        $sFrom = StringRegExpReplace(BinaryToString($sFrom, 4), ".*>(.*)<.*", "$1")
    EndIf
    Local $Result = InetRead($sClient & 'Translate?' & $appID & "&from=" & $sFrom & "&to=" & $sTo & "&text=" & $Data, 3)
    $Result = StringRegExpReplace(BinaryToString($Result, 4), ".*>(.*)<.*", "$1")
    Return $Result
EndFunc   ;==>BingTranslator

 


Regards,
 

Share this post


Link to post
Share on other sites

#9 ·  Posted

thank you very very very very much dear for the helpful responses

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • X_xkijux_x
      By X_xkijux_x
      Ok so im using this program. clarify for school. I would like to have a program that takes every word i type in microsoft word and searches on it in claryfi. is this possible. I would like to have the program not stopping me from typing more after that word. Like when i type a word it auto search it on clarify without making me stop typing and if i want to change i can do that and if im fine that word i can just keep typing and it will search after the next word. 
    • Miliardsto
      By Miliardsto
      Is this possible to make program works like in diagram? There is so much encryption methods and UDFs are they give security? If the $Address will be crypted with some encryption algorithm could be possible to get the value of $Address in easy way? Of course We know its easy too look into autoit code and get value of variable and so We dont want to anyone see $Address value - there are functions Could func1.au3, func2.au3.. be for example func1.php or other type of file? As we know .php files are unnable to see. For example func1 would be read by FileRead() and then Execute() Is this generally possible to do?
      Will it give secure?
      What do you think about? Maybe there is something wrong in this concept or missed.

    • JaredStroeb
      By JaredStroeb
      I need to open an application and send it keys in Session 0.  I have exe's working locally, I can see the application open in session 0 through interactive services, but my send commands do not go to the application.  The following article running-autoit-session-0, directs me to use ControlSend() however my application has no controls that can be identified by AutoIt v3 Window Info.  Get All Windows Controls also returned nothing for the application's handle.  
      What are my options?  
      Can this be done with AutoIt?
      Is there a different "relatively simple" library/tool to use? (I am familiar with C# if there is a viable library there )

       
    • nassausky
      By nassausky
      Hey all,
      Has anyone created any queries for youtube? I was thinking it might be something like this but can't quite figure it out:
      $oIE = _IECreateEmbedded() _IENavigate($oIE,"https://www.youtube.com") Local $oForms = _IETagNameGetCollection($oIE, "form") Local $sTxt = "" For $oForm In $oForms If $oForm.id = "masthead-search" Then $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.id = "masthead-search-term" Then _IEFormElementSetValue($oInput, "cards") _IEFormSubmit($oForm) EndIf Next EndIf Next  
    • Skysnake
      By Skysnake
      Scite comes up occasional, almost incidentally, in some support topics.  I have not found a "Scite" topic in the forums, so this is where I will start.  I have recently been using Scite intensively, specifically with a large project and I have certain issues.  I know that Scite is not an AutoIt product, but it is so closely integrated to the core release that it makes sense to raise issues and request support here.  If this is not the right please refer me to the right forum.
      Thx
       
      Skysnake