Guest User

Untitled

a guest
Oct 13th, 2026
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey v2.0
  2. #SingleInstance Force
  3.  
  4. ; Toggles Sound Blaster X4 output between speakers (line out) and headphones.
  5. ; sbx4out.exe must sit next to this script.
  6. SBX4OUT := A_ScriptDir "\sbx4out.exe"
  7.  
  8. ^!o:: Sbx4("toggle")       ; Ctrl+Alt+O  toggle
  9. ^!+s:: Sbx4("speakers")    ; Ctrl+Alt+Shift+S  force speakers
  10. ^!+h:: Sbx4("headphones")  ; Ctrl+Alt+Shift+H  force headphones
  11.  
  12. Sbx4(action) {
  13.     tmp := A_Temp "\sbx4out.txt"
  14.     code := RunWait(A_ComSpec ' /c ""' SBX4OUT '" ' action ' > "' tmp '" 2>&1"', , "Hide")
  15.     out := FileExist(tmp) ? Trim(FileRead(tmp), " `r`n") : ""
  16.     if (code != 0)
  17.         msg := "X4 switch failed:`n" out
  18.     else if InStr(out, "headphones")
  19.         msg := "🎧 Headphones"
  20.     else
  21.         msg := "🔊 Speakers"
  22.     ToolTip(msg)
  23.     SetTimer(() => ToolTip(), -1500)
  24. }
  25.  
Add Comment
Please, Sign In to add comment