Old 11-27-2021, 06:50 AM   #1
bamsehopp
Human being with feelings
 
Join Date: Sep 2018
Posts: 73
Default Combining actions from different sections

I'm trying to call some actions from the main section when in the media explorer. Is this possible?

Here's what I'm trying to do:

When browsing the media explorer I want to insert an item at the play position, so I can effectively play the item and insert it at the play cursor with a keystroke. But there is no action in the media explorer section to move the edit cursor to the play cursor, so either I make my own script for that or there is a way to call an action from the main section when in the explorer.

Hope it makes sense!
bamsehopp is offline   Reply With Quote
Old 11-27-2021, 08:35 AM   #2
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

Sending a command from Main to Media Explorer in LUA:

Code:
 me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 40064, 0, 0, 0)
Sending a command from Media explorer to Main in PYTHON:

Code:
SWS_ITEM_COLOR_1 = RPR_NamedCommandLookup('_RSaad5165bbc3c416b661dbd27d71fdc9acca10b9b')

RPR_Main_OnCommand(SWS_ITEM_COLOR_1, 0)
Arthur McArthur is offline   Reply With Quote
Old 11-30-2021, 11:01 AM   #3
bamsehopp
Human being with feelings
 
Join Date: Sep 2018
Posts: 73
Default

Quote:
Originally Posted by Arthur McArthur View Post
Sending a command from Main to Media Explorer in LUA:

Code:
 me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 40064, 0, 0, 0)
Sending a command from Media explorer to Main in PYTHON:

Code:
SWS_ITEM_COLOR_1 = RPR_NamedCommandLookup('_RSaad5165bbc3c416b661dbd27d71fdc9acca10b9b')

RPR_Main_OnCommand(SWS_ITEM_COLOR_1, 0)
Thanks for the response! however I'm quite a noob on this, how would I use the LUA one? Make a new script in the media explorer and paste the action ID somewhere in that code?
bamsehopp is offline   Reply With Quote
Old 11-30-2021, 11:11 AM   #4
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by bamsehopp View Post
Thanks for the response! however I'm quite a noob on this, how would I use the LUA one? Make a new script in the media explorer and paste the action ID somewhere in that code?
Exactly!
vitalker is offline   Reply With Quote
Old 11-30-2021, 11:11 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,612
Default

Probably by replacing RPR_ with reaper. if I remember correctly.
But I never did Python.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-30-2021, 11:30 AM   #6
bamsehopp
Human being with feelings
 
Join Date: Sep 2018
Posts: 73
Default

I got it working! I found the reaper.Main_OnCommandEx(COMMAND-ID, 1, 0) action and used it to paste the action id in there! But alas when I put that script in a custom action it doesn't work anyway, probably because the script executes slower than the native action...

this is what I want:

1. Script: moving the edit cursor to the play cursor
2. Insert media item (at play cursor)

but it just inserts to wherever the edit cursor is .. :/
bamsehopp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.