Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- msgbox,% ConvertText("ghbdtn", Layout)
- ConvertText(Text, ByRef OppositeLayout)
- {
- Static Cyr := "ЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ/ёйцукенгшщзхъфывапролджэячсмитьбю,.""№;?:"
- , Lat := "~QWERTYUIOP{}ASDFGHJKL:""ZXCVBNM<>|``qwertyuiop[]asdfghjkl;'zxcvbnm,.?/@#$&^"
- RegExReplace(Text, "i)[A-Z@#\$\^&\[\]'`\{}]", "", LatCount)
- RegExReplace(Text, "i)[А-ЯЁ№]", "", CyrCount)
- if (LatCount != CyrCount)
- {
- CurrentLayout := LatCount > CyrCount ? "Lat" : "Cyr"
- OppositeLayout := LatCount > CyrCount ? "Cyr" : "Lat"
- }
- else
- {
- threadId := DllCall("GetWindowThreadProcessId", Ptr, WinExist("A"), UInt, 0, Ptr)
- landId := DllCall("GetKeyboardLayout", Ptr, threadId, Ptr) & 0xFFFF
- if (landId = 0x409)
- CurrentLayout := "Lat", OppositeLayout := "Cyr"
- else
- CurrentLayout := "Cyr", OppositeLayout := "Lat"
- }
- Loop, parse, Text
- NewText .= (found := InStr(%CurrentLayout%, A_LoopField, 1))
- ? SubStr(%OppositeLayout%, found, 1) : A_LoopField
- Return NewText
- }
- Gui, Add, Edit, x42 y39 w260 h60 , Edit
- Gui, Add, Button, x102 y139 w110 h30 , Button
- Gui, Add, Edit, x42 y179 w260 h70 , Edit
- ; Generated using SmartGUI Creator 4.0
- Gui, Show, x137 y122 h349 w402, New GUI Window
- Return
- GuiClose:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement