ahk-scripts/script-1.ahk
2026-05-06 18:44:05 +02:00

97 lines
2.5 KiB
AutoHotkey

!-:: { ; Alt + Minus
SetKeyDelay 5, 5 ; 5 ms delay, 5 ms press duration
SendEvent "47skildpaddeR"
}
!.:: { ; Alt + Period
SetKeyDelay 5, 5 ; slightly longer for reliability
SendEvent "ssh pi@192.168.0.236"
SendEvent "{Enter}"
Sleep 1500 ; wait for SSH prompt
SendEvent "costarica"
SendEvent "{Enter}"
}
!,:: { ; Alt + Comma
SetKeyDelay 50, 50 ; slow enough for the Run dialog
SendEvent "#r" ; Win + R
Sleep 200 ; wait for Run dialog to open
SendEvent "cmd"
Sleep 100
SendEvent "{Enter}"
; Now trigger Alt + Period hotkey
Sleep 500
Send "!." ; this sends Alt + Period keypress
}
!ø:: { ; Alt + Ø
SetKeyDelay 50, 50 ; slow enough for the Run dialog
SendEvent "#r" ; Win + R
Sleep 200 ; wait for Run dialog to open
SendEvent "cmd"
Sleep 100
SendEvent "{Enter}"
; Now trigger Alt + Period hotkey
Sleep 500
SendEvent "shutdown /s"
}
resState := 0
PgDn:: {
global resState
if (resState = 0) {
w := 2600, h := 1440, hz := 100 ; <-- change 60 to your custom res refresh rate
} else {
w := 3440, h := 1440, hz := 100 ; <-- change 144 to your ultrawide refresh rate
}
DEVMODE := Buffer(156, 0)
NumPut("UInt", 156, DEVMODE, 36)
NumPut("UInt", 0x5C0000, DEVMODE, 40) ; includes refresh rate flag now
NumPut("UInt", w, DEVMODE, 108)
NumPut("UInt", h, DEVMODE, 112)
NumPut("UInt", hz, DEVMODE, 120)
result := DllCall("ChangeDisplaySettingsExW",
"Ptr", 0,
"Ptr", DEVMODE,
"Ptr", 0,
"UInt", 0,
"Ptr", 0)
if (result = 0) {
ToolTip "Resolution: " w "x" h " @ " hz "Hz"
resState := !resState
} else {
ToolTip "Failed (code " result ")"
}
SetTimer () => ToolTip(), -2000
}
F9:: {
output := ""
loop 300 {
DEVMODE := Buffer(156, 0)
NumPut("UInt", 156, DEVMODE, 36)
result := DllCall("EnumDisplaySettingsW",
"Ptr", 0,
"UInt", A_Index - 1,
"Ptr", DEVMODE)
if !result
break
w := NumGet(DEVMODE, 108, "UInt")
h := NumGet(DEVMODE, 112, "UInt")
hz := NumGet(DEVMODE, 120, "UInt")
bpp := NumGet(DEVMODE, 104, "UInt")
output .= w "x" h " @ " hz "Hz " bpp "bpp`n"
}
if (output = "")
MsgBox "No modes found"
else
MsgBox output
}