Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- ; Toggles Sound Blaster X4 output between speakers (line out) and headphones.
- ; sbx4out.exe must sit next to this script.
- SBX4OUT := A_ScriptDir "\sbx4out.exe"
- ^!o:: Sbx4("toggle") ; Ctrl+Alt+O toggle
- ^!+s:: Sbx4("speakers") ; Ctrl+Alt+Shift+S force speakers
- ^!+h:: Sbx4("headphones") ; Ctrl+Alt+Shift+H force headphones
- Sbx4(action) {
- tmp := A_Temp "\sbx4out.txt"
- code := RunWait(A_ComSpec ' /c ""' SBX4OUT '" ' action ' > "' tmp '" 2>&1"', , "Hide")
- out := FileExist(tmp) ? Trim(FileRead(tmp), " `r`n") : ""
- if (code != 0)
- msg := "X4 switch failed:`n" out
- else if InStr(out, "headphones")
- msg := "🎧 Headphones"
- else
- msg := "🔊 Speakers"
- ToolTip(msg)
- SetTimer(() => ToolTip(), -1500)
- }
Add Comment
Please, Sign In to add comment