Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 12-08-2019, 10:55 AM   #1
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default (ME and Arrange): How do you all handle this annoying thing ?

I wish there would be some way that when going in Play in Arrange, Media Explorer Preview will stop automatically.

Lemme explain:
I often preview long files in Media Explorer.
While the preview is ongoing, then giving focus to Arrange window and hit Play, the ME preview doesn't stop and i hear a mess, which i'd rather not want.

Having to stop ME Preview first before doing Play in Arrange, so i don't hear the 2 togeher (aka: The Mess): rather cumbersome.

Any thoughts ? Solutions ? Workarounds ?
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 12-09-2019, 03:08 AM   #2
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

One workaround you can try is stopping the preview via script.


Try, for instance, this .LUA script and add it to the [Main Section] of the Action List:
Quote:
me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 1009, 0, 0, 0) -- [Media Explorer] - Preview: Stop
reaper.Main_OnCommand(40044, 0) -- [Main] - Transport: Play/stop
The JS_ functions are part of the js_ReaScriptAPI (available via ReaPack).

----------------

Haven't tried it yet, but I guess it's also possible to just keep this part in a script:
Quote:
me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 1009, 0, 0, 0) -- [Media Explorer] - Preview: Stop
And then using this script as part of a Custom Action.
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 12-09-2019, 03:27 AM   #3
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Fantastic !

The first script doesn't work: it breaks Play/Stop Action in Arrange.
But the second (shorter) script works.

Thank you solger, i am very happy !
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 12-09-2019, 03:31 AM   #4
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Great
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 12-09-2019, 04:09 AM   #5
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 853
Default

This is awesome Solger - thank you!

While you're out here solving magic media explorer issues - any chance you could take a look at either of these? -

Stop the list selection from resetting when clicking in blank space in the media explorer? I'm constantly clicking back and forth and losing my place in a long list if I click in the wrong spot. I know I can spot the last selected items name at the bottom of the preview window, but often it's too long and I'll need to stretch the media explorer right out (I have it docked to the right). It's just a pain when it's happening every five minutes.

When double clicking to insert item(s) on a new track, place the new track directly below the currently selected, rather than the always at the bottom of the project - it's a pain in big projects (I'm guessing this is deceptively complicated though, as I'm yet to even find a script for 'move selected track directly below last selected track', I suppose folder hierarchy makes things tricky).

I'm guessing neither of these are particularly simple, but I figured there's no harm in asking. I wouldn't have assumed the vanhaze's request was easily solvable, but you smashed it out in two lines of code
Joe90 is offline   Reply With Quote
Old 12-09-2019, 04:45 AM   #6
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Joe90 View Post
Stop the list selection from resetting when clicking in blank space in the media explorer? I'm constantly clicking back and forth and losing my place in a long list if I click in the wrong spot. I know I can spot the last selected items name at the bottom of the preview window, but often it's too long and I'll need to stretch the media explorer right out (I have it docked to the right). It's just a pain when it's happening every five minutes.
Unfortunately, it doesn't look like there's an option/workaround to prevent that behavior.
Quote:
Originally Posted by Joe90 View Post
When double clicking to insert item(s) on a new track, place the new track directly below the currently selected, rather than the always at the bottom of the project - it's a pain in big projects (I'm guessing this is deceptively complicated though, as I'm yet to even find a script for 'move selected track directly below last selected track', I suppose folder hierarchy makes things tricky).

One possible workaround to try is something like this LUA script (which inserts a new track under the selected one and inserts the selected media from the Media Explorer there):
Quote:
reaper.Main_OnCommand(40001, 0) -- [Main] - Track: Insert new track

me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 40063, 0, 0, 0) -- [Media Explorer] - Options: Insert media on selected track
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 1013, 0, 0, 0) -- [Media Explorer] - Browser: Browse selected folder, or insert selected media file
The third code line can be omitted if the Default Action option in the Media Explorer is already set to Insert media on selected tracks:
Quote:
reaper.Main_OnCommand(40001, 0) -- [Main] - Track: Insert new track

me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 1013, 0, 0, 0) -- [Media Explorer] - Browser: Browse selected folder, or insert selected media file
---------------

Since there are no Mouse Modifiers available for the Media Explorer, intercepting mouse click behaviors can be quite difficult to do without breaking something else (assuming it might be possible somehow) since such things usually require having a 'listener' script constantly running in the background. Not sure though if this might perhaps also be possible with the js_ReaScriptAPI (haven't tried it yet).
__________________
ReaLauncher

Last edited by solger; 12-09-2019 at 05:45 AM.
solger is offline   Reply With Quote
Old 12-09-2019, 09:23 AM   #7
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 853
Default

Thanks Solger! Unfortunately it doesn't create multiple tracks when importing multiple items - any way around that?
Joe90 is offline   Reply With Quote
Old 12-09-2019, 11:34 AM   #8
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Joe90 View Post
Unfortunately it doesn't create multiple tracks when importing multiple items - any way around that?
Here's an adapted version which you can try:
Code:
reaper.Undo_BeginBlock()

reaper.Main_OnCommand(40001, 0) -- [Main] - Track: Insert new track

me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 40063, 0, 0, 0) -- [Media Explorer] - Options: Insert media on selected track
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 1013, 0, 0, 0) -- [Media Explorer] - Browser: Browse selected folder, or insert selected media file 

reaper.Main_OnCommand(reaper.NamedCommandLookup("_RS2c668396a00b01e9007a830c381539faf677cac5"), 0) -- mordi_Move selected items to new individual tracks.lua
reaper.Main_OnCommand(40005, 0) -- [Main] - Track: Remove tracks

reaper.Undo_EndBlock("Insert selected media files onto separate tracks", 1)
Additional notes:
  • The Move selected items to new individual tracks script by Mordi is available via ReaPack.
  • The script might have a different Action ID (than '_RS2c668396a00b01e9007a830c381539faf677cac5') in your Action List. So you'll problably have to change the ID part in the script accordingly.
  • The current (quickly assembled) script version most likely needs some additional code lines for re-setting the edit cursor position afterwards
__________________
ReaLauncher

Last edited by solger; 12-09-2019 at 12:16 PM. Reason: added undo block to code
solger is offline   Reply With Quote
Old 12-09-2019, 12:19 PM   #9
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by solger
The current (quickly assembled) script version most likely needs some additional code lines for re-setting the edit cursor position afterwards
Here's a slightly improved version which stores and recalls the edit cursor position:

Code:
reaper.Undo_BeginBlock()

reaper.Main_OnCommand(40001, 0) -- [Main] - Track: Insert new track
reaper.Main_OnCommand(reaper.NamedCommandLookup("_XENAKIOS_DOSTORECURPOS"), 0) -- Xenakios/SWS: Store edit cursor position

me = reaper.JS_Window_Find("Media Explorer", true)
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 40063, 0, 0, 0) -- [Media Explorer] - Options: Insert media on selected track
reaper.JS_WindowMessage_Send(me, "WM_COMMAND", 1013, 0, 0, 0) -- [Media Explorer] - Browser: Browse selected folder, or insert selected media file 

reaper.Main_OnCommand(reaper.NamedCommandLookup("_RS2c668396a00b01e9007a830c381539faf677cac5"), 0) -- mordi_Move selected items to new individual tracks.lua
reaper.Main_OnCommand(40005, 0) -- [Main] - Track: Remove tracks
reaper.Main_OnCommand(reaper.NamedCommandLookup("_XENAKIOS_DORECALLCURPOS"), 0) -- Xenakios/SWS: Recall edit cursor position

reaper.Undo_EndBlock("Insert selected media files onto separate tracks", 1)
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 12-09-2019, 12:40 PM   #10
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 853
Default

Solger - Amazing! Thank you. Do you have a means of receiving donations?

One last question and then I'll leave you alone I promise - do you know if there's a quick tweak I can make to the mordi script so that it doesn't prompt me each time I import multiple items? It doesn't make much difference if it's vertical or sequential to me (although I'd generally choose vertical if given the option). I'd mainly prefer it to just act without prompting - I suspect this might be a simple as just removing a few lines of the code, so I thought I'd ask and see.

Thanks again for your help.
Joe90 is offline   Reply With Quote
Old 12-09-2019, 12:55 PM   #11
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Joe90 View Post
do you know if there's a quick tweak I can make to the mordi script so that it doesn't prompt me each time I import multiple items? It doesn't make much difference if it's vertical or sequential to me (although I'd generally choose vertical if given the option). I'd mainly prefer it to just act without prompting - I suspect this might be a simple as just removing a few lines of the code, so I thought I'd ask and see.
A quick option for always doing a vertical arrangement automatically is to change line 59
Code:
should_line_up = reaper.ShowMessageBox("Do you want the items to line up vertically?", SCRIPT_TITLE, 3)
to
Code:
should_line_up = 6
-------------------

Another option is to remove lines 59-64 completely:
Code:
should_line_up = reaper.ShowMessageBox("Do you want the items to line up vertically?", SCRIPT_TITLE, 3)

-- Check if "cancel" was pressed
if should_line_up == 2 then
  return
end
And then changing lines 87-90 from this:
Code:
-- Move item to first item's position
  if should_line_up == 6 then
    reaper.SetMediaItemPosition(sel[i].item, sel[1].pos, false)
  end
to this:
Code:
  -- Move item to first item's position
  reaper.SetMediaItemPosition(sel[i].item, sel[1].pos, false)
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 12-09-2019, 01:16 PM   #12
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Joe90 View Post
Amazing! Thank you.
Sure, no problem. That's what the Reaper forum is here for

Quote:
Do you have a means of receiving donations?
No, currently not.
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 12-09-2019, 03:00 PM   #13
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 853
Default

That did the trick. Thanks again solger.
Joe90 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 05:07 AM.


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