Websocket API and Shift, Alt or Ctrl OBS_KEY_

enovasoft

New Member
Tell me what command in websocket to tell OBS to make a hotkey for e.g. SHIFT+4



command, it responds fine:

Send-OBSTriggerHotkeyByKeySequence -KeyId 'OBS_KEY_4'



but on a command with SHIFT, no longer and has the error:

Send-OBSTriggerHotkeyByKeySequence -KeyId 'OBS_KEY_4' -KeyModifiersshift



What is the secret of passing the SHIFT, ALT and CTRL keys ?



My piece of code, with an error at Shift:
rem --- hotkey ---
if /I "%mode%"=="4" (
set "trigger=Send-OBSTriggerHotkeyByKeySequence -KeyId 'OBS_KEY_4'"
) else if /I "%mode%"=="shift7" (
set "trigger=Send-OBSTriggerHotkeyByKeySequence -KeyId 'OBS_KEY_7' -KeyModifiersshift"
) else (
exit /B 1
)

rem --- PowerShell 7 ---
pwsh -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Import-Module obs-powershell -Force; $uri=[uri]'%uri%'; $token='%token%'; Connect-OBS -WebSocketUri $uri -WebSocketToken $token; %trigger%; Disconnect-OBS;"

endlocal
 

onyx_online

New Member
I just tested this as well and coudn't get it working.

Code:
Import-Module obs-powershell

Connect-OBS -WebSocketToken $Env:OBS_PASSWORD

Send-OBSTriggerHotkeyByKeySequence -KeyId 'OBS_KEY_F1' -KeyModifiersshift -KeyModifierscontrol

Disconnect-OBS

Consider raising an issue on the official repository.
 

onyx_online

New Member
I did manage to get it working by passing an object, however.

Code:
Import-Module obs-powershell

Connect-OBS -WebSocketToken $Env:OBS_PASSWORD

$modifiers = [PSCustomObject]@{
    shift   = $true
    control = $true
    alt     = $false
    command = $false
}

Send-OBSTriggerHotkeyByKeySequence -KeyId 'OBS_KEY_F1' -KeyModifiers $modifiers

Disconnect-OBS

So not sure why the named parameters weren't working.
 
Top