Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- }
- :?:!шиф::
- Input, firs, V, {Enter}
- msgbox, ConvertText(%firs%, Layout)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement