We already have AddRemoveReaScript(), so I can add successfully ReaScripts.
But sometimes, I would like to add actions and shortcuts as well.
So I would love to suggest API-functions:
AddRemoveReaAction() as well as AddRemoveShortcut()
Code:
integer = reaper.AddRemoveReaAction(boolean add, integer sectionID, string action_command_ids, string description, string ActionCommandID, boolean commit)
works like AddRemoveReaScript but adds actions instead of scripts.
action_command_ids - the ActionCommandIDs/CommandIDs as comma-separated-csv-string
description - holds the description shown in the Action-List
ActionCommandID - the action-command-id, under which this action can be called. Function returns 0, if ActionCommandID is already given(add=true)
Code:
integer = reaper.AddRemoveShortcut(boolean add, integer modifier, integer key_midi, string action_command_id, integer sectionID, boolean commit)
adds shortcuts to your script, as added into reaper-kb.ini.
integer modifier and integer key_midi - the modifier and the key/midinotes used as shortcut.
string ActionCommandID - action-command-id, to which this shortcut is associated. Function returns 0, if ActionCommandID is already given(add=true)
Especially adding/removing shortcuts would be helpful, as I would love to have different keyboard-layouts, that I would love to change using a script, like having F1 to F4 for 4 different Keyboard-Layouts for different usecases.
Easy change of keyboard-layouts is something some video-editing-programs have, like AVID. If that would be codeable, this would be great.
Even if it only supports the modifier/key/midinote-integer-numbers set in the kb.ini it would be helpful, as I already documented all these shortcut-codes for further usage. They could be referenced, then.
The usecase for adding actions:
When I write a script, I sometimes would love to give alternative versions of this script. In many cases, this could be done quite easily by adding actions, that do additional things before/after my script.
I would love to automatically add these actions from within my script, so users would not need to create them by hand, as this is unhandy or difficult for new users.
So adding actions "from the backdoor" would be a nice addition to adding scripts.
Edit:
Regarding AddRemoveReaScript(), I would love to see additional parameters for description and the action-commandid itself. I prefer having human-readable action-command-ids in my scripts and I would love to add useful descriptions automatically as well for easier understanding, what my script does.
If these parameters are set to nil, the function works, like it already does.
If an ActionCommandID is already existing and add=true, the function returns 0.