Is there a way to invoke "hotkey" actions from a script or program (Lua, Python, or websockets)?

The "Hotkeys" list under Settings contains many items that would be nice to invoke from a program or script. Some seem to have API equivalents that can be called from Lua or Python. There are websockets actions for some.

But I don't see any way to invoke others, such as "Next slide" and "Previous slide" for the Slide Show source.

Since hotkeys are discrete actions, it would seem straightforward to have an enumeration or text strings for each item in the hotkey list, and pass that to a function or websockets interface. (Passing the hotkey itself would be less desirable - there are a LOT of potential actions, it can be a pain to find keys that don't conflict with other program functions)
 
Thanks.
TriggerHotkeyBySequence would let me pass hotkey combination, but as I said above, it would be nice to invoke things without first having to assign a non-conflicting hot key.

TriggerHotkeyByName is what I want - but it needs the "unique name of the hotkey, as defined when registering the hotkey." That is cool for key actions that my script defines, but my current needs are to invoke actions pre-defined by OBS. For example, "Next Slide" and "Previous Slide." Do these have "unique names"? If so, where are they documented?
 

Mango

Member
I see that the hotkeys for slide shows are not stored with the other hotkeys in %APPDATA%\obs-studio\basic\profiles\[profilename]\basic.ini. Instead they are stored in %APPDATA%\obs-studio\basic\scenes\[scenename].ini. I created two slide shows for testing purposes and the hotkey names seem to be both called SlideShow.NextSlide. I don't know how to address a particular slide show. If you pass SlideShow.NextSlide to TriggerHotkeyByName, I don't suppose that works?

In your position I ended up writing my own slide show script using a browser source.
 
Nice detective work!
On my PC the \scenes\ information is stored in .json files, but the item names are the same as you indicated.
Time to dig into websockets, I guess.
 

upgradeQ

Member
There is a function obs_source_media_next(source) for Slide Show source . You can also inject hotkey events via script like this.
signal_handler_signal(signal_handler, "media_next", NULL_OR_PARAMS) - also might help, though it fails for some reason.
 

TheKiwiviwy

New Member
I see that the hotkeys for slide shows are not stored with the other hotkeys in %APPDATA%\obs-studio\basic\profiles\[profilename]\basic.ini. Instead they are stored in %APPDATA%\obs-studio\basic\scenes\[scenename].ini. I created two slide shows for testing purposes and the hotkey names seem to be both called SlideShow.NextSlide. I don't know how to address a particular slide show. If you pass SlideShow.NextSlide to TriggerHotkeyByName, I don't suppose that works?

In your position I ended up writing my own slide show script using a browser source.
The solution is partially there, after i did some testing i found out the real answer on how to make it work.
While the documentation implies that you need to put the name of the scene and then the hotkey as there for the example of: Replaybuffer.Save

The actual answer for me was: ( This example was done using NOOBS CMDR )
/command=TriggerHotkeyByName,hotkeyName=fast_forward

I didn't had to put the name of the scene, and the fast_forward section was the name that i found on the .json files ( located in %APPDATA%\obs-studio\basic\scenes\ )

so in short, just look up the hotkey name in the .json files and that should be the input that needs to go after the hotkeyName=
 

untoldent

New Member
OBS Extended Touch Portal user here. The hotkey names are SlideShow.PreviousSlide and SlideShow.NextSlide.
But those seem generic? What happens if i have multiple slideshows, and i want to trigger a hotkey that advances one, but not the other?
 
Top