RPR Main OnCommandEx
From CockosWiki
Main Page/REAPER Documentation/ReaScript/ReaScript API/RPR Main OnCommandEx
Main Page/REAPER Documentation/REAPER API/REAPER API Functions/RPR Main OnCommandEx
Contents |
Main_OnCommandEx()
void Main_OnCommandEx(int command, int flag, void* proj)
You can call any REAPER action from ReaScript by using this API function.
e.g. RPR_Main_OnCommand(actionnumber, 0)
Find the action number for a given action by opening the Actions list, scroll the window right to show the action numbers. For example, from ReaScript you can call the REAPER action "Item: Split item under mouse cursor", like this:
RPR_Main_OnCommand(40746, 0)
This and the RPR_MIDIEditor functions are the APIs you need to start with if you're going to use ReaScript as an advanced macro language.
Parameters
int command, int flag, void* proj
Returns
void
Examples
C++
Perl
# # First.pl # # simulate pressing the play button in the current project RPR_Main_OnCommand(1007,0);
Python
import warnings; SWS_ITEM_COLOR_1 = 53301 SWS_TRACK_COLOR_1 = 53275 selTracks =RPR_CountSelectedTracks(0) selItems = RPR_CountSelectedMediaItems(0) if (selTracks>0 and selItems==0): RPR_Main_OnCommand(SWS_TRACK_COLOR_1, 0) if (selTracks==0 and selItems>0): RPR_Main_OnCommand(SWS_ITEM_COLOR_1, 0) if (selTracks>0 and selItems>0): RPR_Main_OnCommand(SWS_ITEM_COLOR_1, 0) RPR_Main_OnCommand(SWS_TRACK_COLOR_1, 0)
See Also
Stuff
Main Page/REAPER Documentation/ReaScript/ReaScript API/RPR Main OnCommandEx
Main Page/REAPER Documentation/REAPER API/REAPER API Functions/RPR Main OnCommandEx
Categories: API | ReaScript | Perl | Python
