Skip to content

Instantly share code, notes, and snippets.

@maciekish
Last active March 3, 2026 11:45
Show Gist options
  • Select an option

  • Save maciekish/d41c7375e6ee495e4e841768f2f9b849 to your computer and use it in GitHub Desktop.

Select an option

Save maciekish/d41c7375e6ee495e4e841768f2f9b849 to your computer and use it in GitHub Desktop.
AutoHotkey Scripts
#SingleInstance, Force
#NoTrayIcon
;-----------------------------ABOUT-------------------------------
; This script switches audio devices and launches Big Picture Mode
;-----------------------------HOW TO------------------------------
;- 1) Download NirCmd and run as admin to install to Win dir. -
;- http://nircmd.nirsoft.net/setdefaultsounddevice.html -
;- 2) Download MultiMonitorTool and install to Win dir. -
;- https://www.nirsoft.net/utils/multi_monitor_tool.html
;- 2) Change Device names below to match your playback devices. -
;- 3) Change Steam path below to match where Steam is installed. -
;-----------------------------------------------------------------
; https://gist.github.com/maciekish/d41c7375e6ee495e4e841768f2f9b849#file-bigpicture-ahk
;-----------------------Variables & AUTORUN-----------------------
CoordMode, ToolTip, Screen
;------------------------Snippets of Code-------------------------
DesktopSound()
#B::
Toggle := !Toggle
If Toggle {
TVMode()
return
}
Else {
DesktopMode()
return
}
;#S::
;ToggleSound := !ToggleSound
;If ToggleSound {
; DesktopSound()
; return
;}
;Else {
; TVSound()
; return
;}
DesktopSound() {
run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "Speakers" 0
run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "Speakers" 1
run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "Headphone" 2
run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "Headphones" 2
}
TVSound() {
run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "LG TV" 0
run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "LG TV" 1
}
DesktopMode() {
ToolTip, Desktop Mode, 1280, 720
SetTimer, RemoveToolTip, 4000
MonitorPowerOn()
run, "D:\Program Files (x86)\Steam\Steam.exe" -shutdown
LivingRoomPowerOff()
Sleep, 5000
run %ComSpec% /c MultiMonitorTool.exe /enable GSMC0C8
Sleep, 5000
run %ComSpec% /c MultiMonitorTool.exe /disable GSM83CD
Sleep, 5000
run %ComSpec% /c MultiMonitorTool.exe /SetMonitors "Name=GSM83CD BitsPerPixel=0 Width=0 Height=0 DisplayFlags=0 DisplayFrequency=0 DisplayOrientation=0 PositionX=0 PositionY=0" "Name=GSMC0C8 Primary=1 BitsPerPixel=32 Width=3840 Height=2160 DisplayFlags=0 DisplayFrequency=120 DisplayOrientation=0 PositionX=0 PositionY=0"
Sleep, 5000
DesktopSound()
return
}
TVMode() {
ToolTip, TV Mode, 1280, 720
SetTimer, RemoveToolTip, 4000
MonitorPowerOff()
LivingRoomPC()
Sleep, 5000
run %ComSpec% /c MultiMonitorTool.exe /enable GSM83CD
Sleep, 5000
run %ComSpec% /c MultiMonitorTool.exe /disable GSMC0C8
Sleep, 5000
run %ComSpec% /c MultiMonitorTool.exe /SetMonitors "Name=GSM83CD Primary=1 BitsPerPixel=32 Width=3840 Height=2160 DisplayFlags=0 DisplayFrequency=120 DisplayOrientation=0 PositionX=0 PositionY=0" "Name=GSMC0C8 BitsPerPixel=0 Width=0 Height=0 DisplayFlags=0 DisplayFrequency=0 DisplayOrientation=0 PositionX=0 PositionY=0"
Sleep, 5000
TVSound()
Sleep, 1000
Run, "steam://open/bigpicture"
return
}
LivingRoomPC() {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://10.0.1.2:8123/api/webhook/pc_on", true)
whr.Send()
;whr.WaitForResponse()
Sleep, 3000
}
LivingRoomPowerOff() {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://10.0.1.2:8123/api/webhook/pc_off", true)
whr.Send()
;whr.WaitForResponse()
Sleep, 2000
}
MonitorPowerOn() {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://10.0.1.2:8123/api/webhook/monitor_on", true)
whr.Send()
;whr.WaitForResponse()
Sleep, 3000
}
MonitorPowerOff() {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://10.0.1.2:8123/api/webhook/monitor_off", true)
whr.Send()
;whr.WaitForResponse()
Sleep, 2000
}
EnableHDR() {
shell := ComObjCreate("WScript.Shell")
shell.RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\GameDVR\EnableHDR", 1, "REG_DWORD")
; Apply the changes by restarting the Desktop Window Manager
Run, %comspec% /c "taskkill /F /IM dwm.exe", , Hide
Sleep, 1000
Run, %comspec% /c "start dwm.exe", , Hide
; Release the shell object
shell := ""
}
DisableHDR() {
shell := ComObjCreate("WScript.Shell")
shell.RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\GameDVR\EnableHDR", 0, "REG_DWORD")
; Apply the changes by restarting the Desktop Window Manager
Run, %comspec% /c "taskkill /F /IM dwm.exe", , Hide
Sleep, 1000
Run, %comspec% /c "start dwm.exe", , Hide
; Release the shell object
shell := ""
}
ToggleHDR() {
Send, {LWin down}{Alt down}b{Alt up}{LWin up}
;Run, ms-settings:display
;SetTitleMatchMode, 2
;Sleep 1000
;WinActivate, Settings
;Send, `t
;Send, `t
;Send, " "
;Sleep 500
;Send !{f4}
;Sleep 100
}
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
#SingleInstance force
#NoTrayIcon
^b::
; https://gist.github.com/maciekish/d41c7375e6ee495e4e841768f2f9b849#file-manamana-ahk
IfWinNotExist Heroes of the Storm
return
WinActivate
Send, +b
Send {Enter}
Sleep, 100
Send, Mana, mana
Send {Enter}
Sleep, 3000
IfWinNotExist Heroes of the Storm
return
WinActivate
Send {Enter}
Sleep, 100
Send, Tu-tu tururu
Send {Enter}
return
#SingleInstance force
#NoTrayIcon
#F::
; https://gist.github.com/maciekish/d41c7375e6ee495e4e841768f2f9b849#file-misc-ahk
RunWait,sc stop "CLink4Service"
run %ComSpec% /c "taskkill /IM CorsairLink4.exe"
Sleep 1000
RunWait,sc start "CLink4Service"
run,"C:\Program Files (x86)\CorsairLink4\CorsairLink4.exe"
Sleep 3000
run %ComSpec% /c "taskkill /IM CorsairLink4.exe"
#SingleInstance, Force
#NoTrayIcon
; https://gist.github.com/maciekish/d41c7375e6ee495e4e841768f2f9b849#file-wake_monitor-ahk
#M::
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://10.0.1.37:1880/gamingroom/monitor", false)
whr.Send()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment