sbz-switch icon indicating copy to clipboard operation
sbz-switch copied to clipboard

Autohotkey Example

Open TheGuardianWolf opened this issue 1 year ago • 0 comments

When I came across this repo, I wanted to make some keyboard macro to make use of the executable. Perhaps providing an example would be useful in the readme or wiki?

I currently have an autohotkey switcher example available:

#SingleInstance Ignore

+NumpadSub::
    {
        RunWait "sbz-switch.exe dump -o _dump.toml",,"Min"
        Dump := FileRead("_dump.toml")
        RegExMatch(Dump, "SelectOutput = (\d)", &SubPat)

        Output := "0"
        IF (SubPat[1] = "0") {
            Output := "1"
        }
        ELSE {
            Output := "0"
        }

        RunWait Format("sbz-switch.exe set -i `"Device Control`" SelectOutput {1}", Output),,"Min"

        RunWait "taskkill /f /im `"NVIDIA Broadcast UI.exe`"",,"Min"
        RunWait "taskkill /f /im `"NVIDIA Broadcast.exe`"",,"Min"
        Run "C:\Program Files\NVIDIA Corporation\NVIDIA Broadcast\NVIDIA Broadcast UI.exe",,"Min"
    }

This will switch audio and restart NVIDIA broadcast (which seems to die when I switch sometimes)

TheGuardianWolf avatar Apr 29 '23 00:04 TheGuardianWolf