Jump to content

Recommended Posts

Posted

Hi AutoIt Programmers!, I just looking for a way to change entered keys in English to Russian keys and reverse, i must clear for you to understand. For example:

 

  • I write keys on keyboard and i forgot to change input language and then the result will be:

Dkflbvbh (Thing we write in fact) ====> Владимир (Thing we want)
 

  • And reverse:

Владимир  ====> Dkflbvbh

Is there any solution without writing constant for each words? for example dlls or WinAPIs.

Posted

If i had to guess, maybe.

I guess the way i would do it, would be with a keyboard hook, detecting each key, and sending the equivalent in the other language, not sure about the reverse too.

How to detect what language you're writing in?

Why not just change the input language and be done with it?

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

Build a character translation table between your latin keyboard and the cyrillic keyboard layout you should have used. See https://en.wikipedia.org/wiki/Keyboard_layout#Cyrillic

Copy this table by pivoting to perform the reverse translation.

Select the word/phrase typed with the wrong layout, copy it to clipboard, get the Unicode text content and perform the translation according to the character map latin -> cyrillic or reverse. Then put the result on the clipboard and paste it on place over the old selection.

Make that an executable launched at startup with hotkeys to trigger the operation.

Edited by jchd
  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted (edited)

Something like this:

 

;To get selected text
;ControlSend('[ACTIVE]', '', '', '^{INS}')

$sText = 'Dkflbvbh' ;ClipGet()
_CorrectKeyBoardLayout($sText, True)
MsgBox(64, @ScriptName, $sText, 0, Default)

_CorrectKeyBoardLayout($sText, False)
MsgBox(64, @ScriptName, $sText, 0, Default)

Func _CorrectKeyBoardLayout(ByRef $sText, $bToCyrilic)
    Local $sLatin_Table = 'QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>qwertyuiop[]asdfghjkl;''zxcvbnm,.'
    Local $sCyrilic_Table = 'ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮйцукенгшщзхъфывапролджэячсмитьбю'
    Local $aText = StringSplit($sText, '')
    Local $iPos
    
    If Not $bToCyrilic Then
        Local $sTmp = $sCyrilic_Table
        $sCyrilic_Table = $sLatin_Table
        $sLatin_Table = $sTmp
    EndIf
    
    $sText = ''
    
    For $i = 1 To $aText[0]
        $iPos = StringInStr($sLatin_Table, $aText[$i], 1)
        
        If $iPos Then
            $sText &= StringMid($sCyrilic_Table, $iPos, 1)
        Else
            $sText &= $aText[$i]
        EndIf
    Next
EndFunc

 

Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

Or using Google:

 

#include <IE.au3>

$sText = 'Dkflbvbh'
_CorrectKeyBoardLayoutIE($sText)
MsgBox(64, @ScriptName, $sText, 0, Default)

$sText = 'ершы шы ьн еуые'
_CorrectKeyBoardLayoutIE($sText)
MsgBox(64, @ScriptName, $sText, 0, Default)

Func _CorrectKeyBoardLayoutIE(ByRef $sText)
    Local $oIE = _IECreate('https://www.google.com/search?q=' & BinaryToString(StringToBinary($sText, 4)), 0, 0)
    Local $oSel = $oIE.Document.QuerySelector('#taw > div:nth-child(2) > div > p > a > b > i')
    
    If Not IsObj($oSel) Then
        $oSel = $oIE.Document.QuerySelector('#fprsl > b > i')
    EndIf
    
    If IsObj($oSel) Then
        $sText = $oSel.InnerText
    EndIf
    
    _IEQuit($oIE)
EndFunc

 

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted
  On 6/7/2020 at 11:05 AM, careca said:

How to detect what language you're writing in?

Expand  

Hi @careca, i want to create a combo box for favorite languages

  On 6/7/2020 at 11:05 AM, careca said:

Why not just change the input language and be done with it?

Expand  

It's useful for me, but in fact my friend wants of me to create this app for her personal use/cause.

Posted
  On 6/7/2020 at 3:14 PM, Colduction said:

my friend wants of me to create this app for her personal use/cause

Expand  

There is ready tools for that.

Caramba Switcher is one of them.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted
  On 6/8/2020 at 2:04 AM, Colduction said:

We need a tool for change keys of English to Russian, Arabic to English, Chinese to English and Indian to English too.

Expand  

Then you will have to study these tables (from Wikipedia for example).

BTW, i have an idea how to prevent (partially) this kind of mistakes when typing:

When user starts to type something, Just show an indicator of keyboard layout (a language flag) under the input area.

Or, make a sound saying the selected language.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
×
×
  • Create New...