Skip to content

Instantly share code, notes, and snippets.

@webdevs-pro
Last active August 3, 2026 03:34
Show Gist options
  • Select an option

  • Save webdevs-pro/9d316c8a27e597a8562fc67777c9ed27 to your computer and use it in GitHub Desktop.

Select an option

Save webdevs-pro/9d316c8a27e597a8562fc67777c9ed27 to your computer and use it in GitHub Desktop.
My AHK skript
; Layout maps for selected-text cycle convert (EN → RU → UA → EN)
; Lower + upper (and shift punctuation) so capitals are preserved by direct remap
layoutCycle := 0
layoutMapEN := "qwertyuiop[]asdfghjkl;'zxcvbnm,.QWERTYUIOP{}ASDFGHJKL:""ZXCVBNM<>"
layoutMapRU := "йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ"
layoutMapUA := "йцукенгшщзхїфівапролджєячсмитьбюЙЦУКЕНГШЩЗХЇФІВАПРОЛДЖЄЯЧСМИТЬБЮ"
return
#F1::
SetInputLang(0x0409)
Sleep, 100
SoundPlay, %A_WinDir%\Media\Speech On.wav
ToolTip, EN
SetTimer, RemoveToolTip, -1000
Return
#F2::
SetInputLang(0x0419)
Sleep, 100
SoundPlay, %A_WinDir%\Media\Speech On.wav
ToolTip, RU
SetTimer, RemoveToolTip, -1000
Return
#F3::
SetInputLang(0x422)
Sleep, 100
SoundPlay, %A_WinDir%\Media\Speech On.wav
ToolTip, UA
SetTimer, RemoveToolTip, -1000
Return
^Space::Send {Media_Play_Pause}
^Right::Send {Media_Next}
^Left::Send {Media_Prev}
SetInputLang(Lang)
{
WinExist("A")
ControlGetFocus, CtrlInFocus
PostMessage, 0x50, 0, % Lang, %CtrlInFocus%
}
^!u::
clipboard := ""
send ^{c}
clipWait, 0.3
stringUpper, clipboard, clipboard
send ^{v}
return
^!l::
clipboard := ""
send ^{c}
clipWait, 0.3
stringLower, clipboard, clipboard
send ^{v}
return
^!t::
clipboard := ""
send ^{c}
clipWait, 0.3
stringLower, clipboard, clipboard, T
send ^{v}
return
; Cycle selected text layout: EN → RU → UA → EN (physical key remap)
^!Space::
clipboard := ""
Send ^{c}
ClipWait, 0.3
if ErrorLevel
return
if (layoutCycle = 0) {
fromMap := layoutMapEN
toMap := layoutMapRU
langId := 0x0419
tip := "EN → RU"
} else if (layoutCycle = 1) {
fromMap := layoutMapRU
toMap := layoutMapUA
langId := 0x0422
tip := "RU → UA"
} else {
fromMap := layoutMapUA
toMap := layoutMapEN
langId := 0x0409
tip := "UA → EN"
}
clipboard := ConvertLayout(clipboard, fromMap, toMap)
Send ^{v}
SetInputLang(langId)
layoutCycle := Mod(layoutCycle + 1, 3)
ToolTip, %tip%
SetTimer, RemoveToolTip, -1000
return
ConvertLayout(text, fromMap, toMap) {
result := ""
Loop, Parse, text
{
char := A_LoopField
pos := InStr(fromMap, char, true)
if (pos)
result .= SubStr(toMap, pos, 1)
else
result .= char
}
return result
}
; ^`::
; Send, ^#{F24}
; TrayTip, , Touchpad toggled
; SetTimer, HideTrayTip, -1000
; return
^Up::
; Get the current system volume
SoundGet, currentVolume
; Increase volume logarithmically
newVolume := LogVolumeChange(currentVolume, 1) ; 1 indicates an increase
; Set the new volume
SoundSet, %newVolume%
; Simulate Volume_Up key to show the volume slider
Send {Volume_Up} ; This will show the volume slider without changing the actual volume
return
^Down::
; Get the current system volume
SoundGet, currentVolume
; Decrease volume logarithmically
newVolume := LogVolumeChange(currentVolume, -1) ; -1 indicates a decrease
; Set the new volume
SoundSet, %newVolume%
; Simulate Volume_Down key to show the volume slider
Send {Volume_Down} ; This will show the volume slider without changing the actual volume
return
LogVolumeChange(currentVolume, direction) {
; Apply logarithmic change. Adjust the scale factor if needed.
scaleFactor := 1.05
if (direction > 0) ; Increase volume
{
newVolume := currentVolume * scaleFactor
}
else ; Decrease volume
{
newVolume := currentVolume / scaleFactor
}
; Ensure the volume stays within 0 to 100 range
if (newVolume > 100)
newVolume := 100
else if (newVolume < 0)
newVolume := 0
return newVolume
}
HideTrayTip() {
TrayTip
}
RemoveToolTip:
ToolTip
return
XButton1::MButton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment