Skip to content

Instantly share code, notes, and snippets.

@imorrish
Created June 14, 2019 21:31
Show Gist options
  • Save imorrish/e0d8c1cb849b8d9c0521362854c0d77e to your computer and use it in GitHub Desktop.
Save imorrish/e0d8c1cb849b8d9c0521362854c0d77e to your computer and use it in GitHub Desktop.
#Assume we are in the directory with all required files
add-type -path '.\StreamDeckSharp.dll'
#don't have native streamdeck software running or you get an error
$deckInterface = [StreamDeckSharp.StreamDeck]::OpenDevice()
function inputevent($key){
if($key.IsDown){
#run a supersource annimation when button is pressed
switch($key.key){
#0 is top right key
4{selectlayout 1;break}
3{selectlayout 2;break}
2{selectlayout 3;break}
1{selectlayout 4;break}
0{selectlayout 5;break}
}
}
}
#Do this just incase we are re-running the script
Unregister-Event -SourceIdentifier buttonPress -ErrorAction SilentlyContinue #incase we are re-running the script
$KeyEvent = Register-ObjectEvent -InputObject $deckInterface -EventName KeyStateChanged -SourceIdentifier buttonPress -Action {inputevent($eventArgs)}
# rest of your ATEM and supersource code here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment