Old 04-21-2018, 04:13 PM   #1641
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 257
Default

Hi guys,

I recently got into a conversation of a user who needs to go to markers 11 to lets say 30 (or 20 would also be enough).
He wants to press . Then enter marker number 11 and it goes there.

Ive tried to bypass Reaper using autohotkey for Windows and all I am able to do is hold . Plus press 1 or 2 or 3.... and it sends a complex and improbable keycommand to trigger the go to markers action.

Can any one of you do something like this in Eel script please I really want to solve this out and learn at the same time from your code

Thanks in advance,
__________________
Alex | www.drocksrecords.com | Left Cubase Pro 9.5 after 10 years and now enjoying REAPER more than expected | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 04-21-2018, 04:30 PM   #1642
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,929
Default

View: Jump to time window
cfillion is offline   Reply With Quote
Old 04-21-2018, 06:17 PM   #1643
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 257
Default

Thanks Cfillion,

Yes its a good feature I've seen it and it does what I need in the essence of it.

But is there a way to trick Reaper by doing something like "double tap Numpad1 to trigger marker 11" or "press . to open a tiny dialog that gets input 11 then closes itself". I'm looking for an instant method that would be as quick as triggering 1, 2, 3, 4...

Thanks for your reply already I appreciate
__________________
Alex | www.drocksrecords.com | Left Cubase Pro 9.5 after 10 years and now enjoying REAPER more than expected | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 04-27-2018, 12:41 AM   #1644
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 60
Default

Smart Delete Script request.

In my workflow, I need a convenient adaptive deletion function. Is there an item? By pressing the "Delete" button, it is deleted. Is the area selected? By pressing the "Delete" button, the one that was selected is deleted. Is the track selected? When the button is pressed, it is deleted, etc.

The Reaper has its own action "Remove items / tracks / envelope points (depending on focus), 40697", it works fine, but has a big drawback - it ignores the selected area, removing the entire item. This makes it useless for me.

In search of a solution, I found a simple script that shares the action on the work area:

Code:
isSet = reaper.GetSet_LoopTimeRange( 0, 0, 0, 0, 0 )
focus = reaper.GetCursorContext() 

if isSet == 0 then
  reaper.Main_OnCommand(40697, 0)
else
  if focus == 1 then
    reaper.Main_OnCommand(reaper.NamedCommandLookup('40312'), 0)
  elseif focus == 2 then

    reaper.Main_OnCommand(40089, 0)

  end
end
But it also has drawbacks. If the selection is start from the zero position, the entire item is deleted, but not the area. Secondly, if an area is selected, I can not delete items and tracks, until I remove the selection. This makes it useless for me.

I tried to replace the action with "_XENAKIOS_TSADEL", but it solved only one problem - selection from the zero position. But now I can not delete tracks and any selection of the area still blocks the removal of items.

As a result, in this script I use the cut function instead of the delete: "Edit: Cut items / tracks / envelope points (depending on focus) within time selection, if any (smart cut), 41384". This is the lesser of evils. Selecting an area blocks only deleting tracks, but not items. And the second - I constantly have some unexpected things on the clipboard.

I'm not one to give up easily. But I'm not a programmer. And I would be glad if someone helped me to solve my problem.
Perhaps, I always went the wrong way, using this script as a basis.
cool is offline   Reply With Quote
Old 04-28-2018, 01:21 PM   #1645
Vampire TNA
Human being with feelings
 
Join Date: Nov 2009
Posts: 12
Default Move selected track to the end of tracklist (right side of mixer)

Hey guys, here's another request.
I would find it extremely useful if there was a command to move the selected track to the right side of the mixer. The only thing close i found was X-Raym script to move only one place "Script: X-Raym_Move selected tracks down on visible track list.lua".
I would be very much obliged if anyone could program an eel script like:

integer t= total number of tracks
integer s= track number of selected track
integer i= t-s
and the loop X-Raym's script for i times

it would do the trick!
Thanks in advance!
Vampire TNA is offline   Reply With Quote
Old 04-28-2018, 06:44 PM   #1646
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

Hi cool. I rearranged it a small amount to get it closer to what you want, but it sounds like script was a compromise? If you want different priorities, and can't get it yourself, try to phrase a new pseudo code question.

Lua provides the following relational operators:
Code:
<   >   <=  >=  ==  ~=
All these operators always result in true or false.

You can use and,or,not in comparisons. Or you can nest "ifs" to an even greater depth than is present in the script you posted.
Code:
if (A > 0) and (not(B < A)) then
  if C ~= D then
    if (E > F) or (G <= H) then
etc...
That's not all there is to the discussion or anything, but enough to phrase your request, hopefully. Some things in Reaper can't be queried for a value...

You see the difference in using GetSet_LoopTimeRange()? The TWO values returned may be at the same time position and not at 0 if you snap the ends together with the mouse for example.

I use GetCursorContext2(). It tries to return most recent value if something other than track/item/envelope has focus. 0 for track, 1 for items, 2 for envelope.

Don't use NamedCommandLookup() for native REAPER actions.

Code:
-- cool.lua

start, ending = reaper.GetSet_LoopTimeRange( 0, 0, 0, 0, 0 )
--focus = reaper.GetCursorContext()
focus = reaper.GetCursorContext2(true) -- unlikely to get unknown(-1) when arrange not focused

if start == ending then
  reaper.Main_OnCommand(40697, 0)
else
  if focus == 1 then
    reaper.Main_OnCommand(40312, 0)
  elseif focus == 2 then
    reaper.Main_OnCommand(40089, 0)
  else -- alternatively -- elseif focus == 0 then
    reaper.Main_OnCommand(40005, 0) -- remove tracks
  end
end
FnA is offline   Reply With Quote
Old 04-29-2018, 02:26 AM   #1647
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 4,844
Default

@Vampire TNA

The script Script: Move Selected Tracks to the Bottom.lua already exists, I don't remember how made it though, cause there is no signature anywher ein the code or filename. You have to google it ;O

It is not be as efficient than a direct mod of the original script but as long as it works ok... :P
X-Raym is offline   Reply With Quote
Old 04-29-2018, 02:37 AM   #1648
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 4,844
Default

Quick mod, just released X-Raym_Move selected tracks down to the bottom on visible track list.lua in my free script pack.
Works great when there is no track hierarchy :P Use it ostly on parent tracks only. On childtracks, you may need to fix hierarchy after, but still take less time than manual drag and drop.
X-Raym is offline   Reply With Quote
Old 04-29-2018, 02:56 AM   #1649
Vampire TNA
Human being with feelings
 
Join Date: Nov 2009
Posts: 12
Default

Quote:
Originally Posted by X-Raym View Post
cause there is no signature anywher ein the code or filename. You have to google it ;O
I spent hours searching for it. Once you said there was no signature i found it in a minute here:
https://forum.cockos.com/showpost.ph...4&postcount=15
It moves the last of selected tracks to the bottom and moves the other selected tracks by the same amount.

Quote:
Originally Posted by X-Raym View Post
Quick mod, just released X-Raym_Move selected tracks down to the bottom on visible track list.lua in my free script pack.
Works great when there is no track hierarchy :P Use it ostly on parent tracks only. On childtracks, you may need to fix hierarchy after, but still take less time than manual drag and drop.
Now, that was quick!!! And more than i asked for! Thanks a million X-Raym
Vampire TNA is offline   Reply With Quote
Old 04-29-2018, 03:26 AM   #1650
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 4,844
Default

Quote:
Now, that was quick!!!
Yep, that's because the script isn't error free :P I mean, it can output wierd results with complex track selection.

But for 90% of the case, it will be just fine !

Glad it helps :P
X-Raym is offline   Reply With Quote
Old 04-29-2018, 07:05 AM   #1651
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 60
Default

Thank you, FnA! This is very useful for me. Your script works as it should and it's very cool! But there is a only one inconvenience - remove of items and automation points does not work during any active selection of area.
I made a screenshot for clarity.
A scenario is shown when the deletion script does not work: i can not delete selected items and/or points outside the selection boundary. When there is no selected area, any deletion with script works as it should.

I tried to find a command(s) that would check the selection status so that if there are no items within the selection, you could execute another command. But I could not find a solution for this. I guess it's more complicated than simple operations in one or two commands.
Or maybe there is a simpler and more elegant solution for this?

cool is offline   Reply With Quote
Old 04-29-2018, 08:35 AM   #1652
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

1. What is highest consideration: context or time selection?

2. What about automation items?

(Reaper smart cut removes tracks if focused. It also cuts automation items rather than points within them, even if AI is not selected. I realize you want to avoid Cut, because of clipboard.)

edit below:

I think I understand what you want.
not a real script...
Code:
if context == track:
  delete all selected tracks
if context == item:
  if any part of selected items are within time selection:
    delete only selected parts/entire items, which are inside time selection
  else:
    delete all selected items
if context == envelope:
  if any selected points are within time selection: 
    delete only selected points inside time selection
  else:
    delete all selected points
I see there are actions in SWS:
SWS/AW: Remove tracks/items/env, obeying time selection and leaving children
SWS: Remove items/tracks/env, (obey time selection)

but they don't seem to work? They were made before AI, but they don't work even without any AI on envelopes or with items either... I have no idea how to begin with AI. I probably could make something, with labor, for items and envelopes without AI, but I suppose the SWS actions might be updated instead. I see a thread:
https://forum.cockos.com/showthread.php?t=199187
that maybe gives a clue about the complex state of the matter.

Not really finding any other actions. So, I hand it over to more advanced coders.

Last edited by FnA; 04-29-2018 at 06:57 PM.
FnA is offline   Reply With Quote
Old 04-29-2018, 07:36 PM   #1653
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 60
Default

Quote:
Originally Posted by FnA View Post
1. What is highest consideration: context or time selection?

2. What about automation items?
1. On screenshot - context.

2. Automation Items can be ignored. This is convenient in the workflow

Quote:
Originally Posted by FnA View Post
(Reaper smart cut removes tracks if focused. It also cuts automation items rather than points within them, even if AI is not selected. I realize you want to avoid Cut, because of clipboard.)

edit below:

I think I understand what you want.
not a real script...
Yes, you fully understood the problem. As an alternative, I considered a function that cleans the clipboard after each use of the Cut... action. But I could not find her either.

This "code" is what i need, it remains to find the command for "any part of selected items are within time selection" and its analog for envelopes...


Quote:
Originally Posted by FnA View Post
I see there are actions in SWS:
SWS/AW: Remove tracks/items/env, obeying time selection and leaving children
SWS: Remove items/tracks/env, (obey time selection)
but they don't seem to work?
Yes, do not work. This actions are not able to delete the selected area, they delete the items completely.

It's amazing that "Edit: Cut items / tracks / envelope points (depending on focus) within time selection, if any (smart cut)" works fine and flawlessly responds to the context and selection.
I will try to write in the Feature Requests. Chance is small (while 100% of my queries in fr have been ignored, lol), but one small modification of "Remove items / tracks / envelope points (depending on focus)" completely solves my problem without running scripts and programming.

In any case - thank you very much for your help! At this phase, if all other methods do not help me, I'll stay with your script.
cool is offline   Reply With Quote
Old 04-29-2018, 08:36 PM   #1654
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

Quote:
Originally Posted by cool View Post
As an alternative, I considered a function that cleans the clipboard after each use of the Cut... action. But I could not find her either.
cfillion recently introduced Get and Set Clipboard functions. I thought that might be an option, but don't really understand all about it.

Quote:
Originally Posted by cool View Post
This "code" is what i need, it remains to find the command for "any part of selected items are within time selection" and its analog for envelopes...
It is fairly straight forward for items, I think (for someone somewhat familiar with scripting). Envelope may present some difficulties. But I think those SWS actions are not working as they should, and it bothers me to think about potentially struggling with a workaround for that.
FnA is offline   Reply With Quote
Old 04-29-2018, 11:09 PM   #1655
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 60
Default

Ha! It's hard to believe, but I think I completely solved my problem! At least the first tests were excellent!

I combined several solutions - a successful "remove" action and additional commands to solve their requests. Perhaps this does not look correct from the programmer's point of view, but .... it works!
The script has one drawback. With any selection of the area, the automation items are not deleted. But this is a trifle, in my workflow I can ignore it without much trouble.

FnA, James HE, guys, thank you very much for your help! This is priceless for me!

Final code:

Code:
start, ending = reaper.GetSet_LoopTimeRange( 0, 0, 0, 0, 0 )
--focus = reaper.GetCursorContext()
focus = reaper.GetCursorContext2(true) -- unlikely to get unknown(-1) when arrange not focused


  script_title = "Smart Delete Script" 
  reaper.Undo_BeginBlock() 

if start == ending then
  reaper.Main_OnCommand(40697, 0) -- remove items/tracks/...
else
  if focus == 1 then
    reaper.Main_OnCommand(40061, 0) -- split items at time selection
    reaper.Main_OnCommand(40697, 0) -- remove selected area of items
  elseif focus == 2 then
    reaper.Main_OnCommand(40333, 0)  --  delete selected points
  else -- alternatively -- elseif focus == 0 then
    reaper.Main_OnCommand(40697, 0) -- remove tracks
  end
end

  reaper.Undo_EndBlock(script_title, 0)

Last edited by cool; 04-30-2018 at 01:40 AM.
cool is offline   Reply With Quote
Old 04-30-2018, 03:51 AM   #1656
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

Cool!

Guessing you can probably do something similar for automation items. It seems an action for limiting a deletion of selected points to time selection would be a nice utility to have, but I guess I have not really lost any sleep over it thus far.

It probably makes two undo points for the two calls to mainoncommand? I'll try it later with a undoblock to reduce it to one and edit this post. Alternatively you can use namedcommandlookup on a custom action that you make normally.
FnA is offline   Reply With Quote
Old 04-30-2018, 04:23 AM   #1657
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 60
Default

Quote:
Originally Posted by FnA View Post
Guessing you can probably do something similar for automation items. It seems an action for limiting a deletion of selected points to time selection would be a nice utility to have, but I guess I have not really lost any sleep over it thus far.
Ugh. Here again the problems begin Now for the editing of automation items the set of commands is very meager. I do not have to delete part of the automation item. And the cutting command selected one part of the item, and there are no commands to control this selection process.
But, again, I can return to the old kind command of "Smart Cut...", which works all the same, flawlessly. But, it's rubbish again on the clipboard ...

In the end, I made a decision. Just do not touch the items of automation

Quote:
Originally Posted by FnA View Post
It probably makes two undo points for the two calls to mainoncommand? I'll try it later with a undoblock to reduce it to one and edit this post. Alternatively you can use namedcommandlookup on a custom action that you make normally.
Yes I know. So that there were no double entries in the undo entries, I used commands Undo_BeginBlock/Undo_EndBlock. In the script above

Last edited by cool; 04-30-2018 at 04:33 AM.
cool is offline   Reply With Quote
Old 04-30-2018, 04:37 AM   #1658
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

Ha! Just woke up.
FnA is offline   Reply With Quote
Old 05-04-2018, 03:32 AM   #1659
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 381
Default Coalesce two time selections script ?

I have two time selections stored at SWS slots number 3 and 4.
Is it possible to add these two together to make one longer time selection.
It needs to be bi-directional so either time selection could be before or after the other - basically make the earliest start point the beginning of the new time selection and the latest end point the end.
Many thanks
__________________
Brush and Beater Drums Online: www.outoftheboxdrums.co.uk
Triode is offline   Reply With Quote
Old 05-10-2018, 03:30 PM   #1660
Esteban_M
Human being with feelings
 
Esteban_M's Avatar
 
Join Date: Feb 2018
Location: Costa Rica
Posts: 6
Default Custom action: Event Properties Values

Hello dear magicians of Reaper!

Any way to create a custom script to apply certain values in the "Event Properties" windows in "Midi Editor"?

For ex:
I want to modify multiple selected velocities. To do so, I go to the Event Properties window, enter the change wanted in the "Velocity" field and press apply. If I need 2 changes (like a relative change and then increment values) I have to do this twice as seen here: https://forum.cockos.com/showthread.php?t=56117

I'm seeing default actions like "Set event channel higher" which I guess gives a hint that the possibility is there. If such script doesn't exist yet, is there a way to see the code from a default action in order to try using one of those default ones as a guide?

Thanks in advance!
Esteban_M is offline   Reply With Quote
Old 05-10-2018, 09:34 PM   #1661
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 4,844
Default

@Esteban_M
Scripts don't enters values in windows for you. It works at the source, by modifying the elements properties directly.
There is a lot of scripts involving notes velocity, JSFX for effects or Lua for offline processing.

Here is template I made in Lua, which process selected notes in MIDI Editor:

https://github.com/ReaTeam/ReaScript...I%20editor.lua

You only have to add your own math in the middle.

But if you do that everytime for certain tracks, I will advice you to use a track FX insert, so that you just set it once and forget it.
X-Raym is offline   Reply With Quote
Old 05-10-2018, 11:27 PM   #1662
Archie
Human being with feelings
 
Join Date: Oct 2017
Posts: 15
Default

I drew this button: And please tell me how to make it interact with the script? What would it work as a function of reaper.MB ('', '', 0)
for example: here on such an example

button:
PHP Code:
    local function msg(param);reaper.ShowConsoleMsg(param.."\n")end   -- msg('test')
    --------------------------------------------------------------------------------



        
xOut yOut reaper.GetMousePosition()  xOut yOut xOut-230yOut-125                      
        header 
= [=[test test test]=]
        
gfx.clear 4210752
        gfx
.init(header,350 105,0,xOutyOut  )
        ---

    function 
main(numb)

        
gfx.setfont(1,"Verdana",15,117) --&#1091;становить Шрифты
        
gfx.set(0,0.75,0.75,1) -- r,g,b,a, &#1091;станавливаем цвет, которым будем рисовать info
        
gfx.xgfx.2518 -- &#1091;ст. gfx.x, gfx.y, строки рисуются отталкиваясь от этих координат!
        
gfx.drawstr([=[NO SELECTED MEDIA ITEM in TIME SELECTION !]=])
        
gfx.setfont(1,"Verdana",15,105) --&#1091;становить Шрифты
        
gfx.xgfx.10040
        gfx
.drawstr([=[Select an item in time selection ]=])  
        ---

        
local button numb -- = 0  

        gfx
.set(0.4,0.4,0.4,1) -- r,g,b,a, &#1091;станавливаем цвет, которым будем рисовать info        
        
gfx.roundrect(11565100304)--&#1056;исует прямоугольник с закругленными углами.
  
        
if button == 1 then        
            gfx
.gradrect(117,67,97,270.2,0.2,0.2,1)--&#1047;аполняет прямоугольник градиента указанным цветом и альфой(x,y,w,h, r,g,b,a)
        
elseif button == 0 then
            gfx
.gradrect(117,67,97,270.3,0.3,0.3,1)--&#1047;аполняет прямоугольник градиента указанным цветом и альфой(x,y,w,h, r,g,b,a)
        
end
  

        gfx
.line(213,93,117,67 )
        
gfx.line(213,67,117,93 )
        
gfx.roundrect(1196992224)----&#1056;исует прямоугольник с закругленными углами.
  
        
if button == 1 then
            gfx
.gradrect(119,69,92,220.5,0.5,0.5,1)--&#1047;аполняет прямоугольник градиента указанным цветом и альфой(x,y,w,h, r,g,b,a)
        
elseif button == 0 then
            gfx
.gradrect(119,69,92,220.4,0.4,0.4,1)--&#1047;аполняет прямоугольник градиента указанным цветом и альфой(x,y,w,h, r,g,b,a)
        
end
        
---
  
        
gfx.xgfx.15671 -- &#1091;ст. gfx.x, gfx.y, строки рисуются отталкиваясь от этих координат!
        
x,gfx.xgfx.y--&#1091;ст. gfx.x, gfx.y,строки рисуются отталкиваясь от этих координат!
        
gfx.setfont(1,"Verdana",18,105) --&#1091;становить Шрифты
  
        
if button == 1 then
            gfx
.set(0000.3)-- r,g,b,a, &#1091;станавливаем цвет, которым будем рисовать info
        
elseif button == 0 then
            gfx
.set(0000.7)-- r,g,b,a, &#1091;станавливаем цвет, которым будем рисовать info
        
end
        
for 1do
          
gfx.xgfx.iy-i
          gfx
.drawstr("OK")
        
end
  
        gfx
.set(0.8,0.8,0.8,0.9) -- r,g,b,a, &#1091;станавливаем цвет, которым будем рисовать info
        
gfx.xgfx.x,y
        gfx
.drawstr("OK")

    
end
    
---


    ----------------
    function 
Mouse_Is_Inside(xywh) --&#1084;ышь находится внутри
        
local mouse_xmouse_y gfx.mouse_xgfx.mouse_y
        local inside 
=
        
mouse_x >= and mouse_x < (w) and
        
mouse_y >= and mouse_y < (h)
        return 
inside
    end
    
-----------------



    function 
loop()

        -- If 
the left button is down
        
if gfx.mouse_cap&== 1  then
            
-- If the cursor is inside the rectangle AND the button wasn't down before
            if Mouse_Is_Inside(117,70,98,23) and not mouse_btn_down then
                main(1)
                mouse_btn_down = true
                state = 1
            end
        -- If the left button is up
        else
            main(0)
            mouse_btn_down = false
        end
  
        if gfx.mouse_cap&1 == 0 and  Mouse_Is_Inside(117,70,98,23) and state == 1 then gfx.quit() end
        if not Mouse_Is_Inside(117,70,98,23) then state = 0 end
        if gfx.getchar() >= 0 then reaper.defer(loop)else reaper.atexit(gfx.quit) end
        gfx.update()
  
    end

    loop() 
example:
PHP Code:
    local STOP_Script;
    
local function example()
  
        
local start_Loop End_Loop reaper.GetSet_LoopTimeRange0000)
        if 
start_Loop ~= End_Loop then

            local count_item 
reaper.CountSelectedMediaItems)
            for 
1,count_item do
                
local item reaper.GetSelectedMediaItem0i-)
                
local position reaper.GetMediaItemInfo_Valueitem'D_POSITION' )
                
local length reaper.GetMediaItemInfo_Valueitem'D_LENGTH' )
                
local item_end position length
                
if position End_Loop and item_end start_Loop then
                    LoopTime_sel_item 
1
                  
break
                
end
            end
            
if not LoopTime_sel_item then
                local MB 
reaper.MB([=[  NO SELECTED MEDIA ITEM in TIME SELECTION !
  &
#65507; ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
                        
Select an item in time selection
                        
&#65507; ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ]=],
                          
' example  ',0)
                
STOP_Script 1
                
if MB == 1 then return end
                  
            
else
                for 
count_item-1,0,-do
                    
local item reaper.GetSelectedMediaItem0)
                    
local position reaper.GetMediaItemInfo_Valueitem'D_POSITION' )
                    
local length reaper.GetMediaItemInfo_Valueitem'D_LENGTH' )
                    if 
position End_Loop or position+length start_Loop then
                        reaper
.SetMediaItemSelecteditem)
                    
end
                end
            end
        end
    end
    example
()
    
reaper.UpdateArrange() 
Archie is offline   Reply With Quote
Old 05-11-2018, 04:14 PM   #1663
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

Hi Triode. Quick easy version. I guess you could read RPP or something to get the numbers instead, but hopefully this is good enough.

If you use undo points for time selection, you could remove "--" from start of UndoBeginBlock and UndoEndBlock lines. If you do that, you could erase:
function noundo() end
reaper.defer(noundo)

but I don't think it's really necessary.


Code:
-- Coalesce two SWS time selection slots.lua
-- Don't use it if you don't have SWS...

function Fn_Coalesce()
  --reaper.Undo_BeginBlock2(0)
  
  reaper.PreventUIRefresh(1)
  local slot3ok
  local a,b = reaper.GetSet_LoopTimeRange(0, 0, 0, 0, 0)
  reaper.GetSet_LoopTimeRange(1, 0, 0, 0, 0)
  reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_RESTTIME3"),0)
  local c,d = reaper.GetSet_LoopTimeRange(0, 0, 0, 0, 0)
  if c~=d then
    a=c
    b=d
    slot3ok = true
  end
  
  reaper.GetSet_LoopTimeRange(1, 0, 0, 0, 0)
  reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_RESTTIME4"),0)
  local e,f = reaper.GetSet_LoopTimeRange(0, 0, 0, 0, 0)
  if e~=f then
    a=e
    b=f
    if slot3ok == true then
      if c<e then a=c end
      if d>f then b=d end
    end
  end
  
  reaper.GetSet_LoopTimeRange(1, 0, a, b, 0)
  reaper.PreventUIRefresh(-1)
  
  --reaper.Undo_EndBlock2(0, "coalesce time selections 3 and 4", -1)
end

function noundo() end
reaper.defer(noundo)

Fn_Coalesce()

Last edited by FnA; 05-11-2018 at 08:13 PM.
FnA is offline   Reply With Quote
Old 05-11-2018, 05:57 PM   #1664
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 381
Default

Hi FnA
That's great many thanks
__________________
Brush and Beater Drums Online: www.outoftheboxdrums.co.uk
Triode is offline   Reply With Quote
Old 05-11-2018, 06:49 PM   #1665
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

I think there's a chance of an error, in some odd case. I'll edit the script later. OK, I did so. I treat any 0 length time selection basically as "no time selection". Maybe you might want something different? It leaves an existing time selection in place (actually restores it after removal during the script) unless either slot has a time selection of non zero length. Maybe it should remove it in all cases?

Last edited by FnA; 05-11-2018 at 07:54 PM.
FnA is offline   Reply With Quote
Old 05-19-2018, 01:10 AM   #1666
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,318
Default

In Cubase there is a function that, when enabled, automatically selects an Item when you hoover your mouse over it.
Is this functionality maybe scriptable in Reaper ?

Warm Regards.
vanhaze is offline   Reply With Quote
Old 06-04-2018, 12:12 PM   #1667
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 481
Default

I'd really like a script that finds all instances of Reinsert and hits Ping detect on them, please.

Ideally, it'd be 2 buttons.

1. To find and open all instances (to remind me what's where and any reverbs that might need bypassing)
2. Ping!
(3. Close Reinsert windows, so I can hit the space and play)

Last edited by rothchild; 06-04-2018 at 12:37 PM.
rothchild is offline   Reply With Quote
Old 06-09-2018, 11:00 AM   #1668
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 381
Default

Quote:
Originally Posted by FnA View Post
I think there's a chance of an error, in some odd case. I'll edit the script later. OK, I did so. I treat any 0 length time selection basically as "no time selection". Maybe you might want something different? It leaves an existing time selection in place (actually restores it after removal during the script) unless either slot has a time selection of non zero length. Maybe it should remove it in all cases?
Hi!

I've been using this type of script to help shift-select groups of items across tracks (via folders or track groups). Since time selections are always made in my macros before that script the zero time selections are not an issue. Will post some examples to share when I get a spare bit of time. Thanks again
__________________
Brush and Beater Drums Online: www.outoftheboxdrums.co.uk
Triode is offline   Reply With Quote
Old 06-12-2018, 12:48 PM   #1669
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: brighton, uk
Posts: 12,510
Default

Hi SPK77. I only just saw your post but thanks for this. Tried it and it seems to work great so far! Thanks for that! It's perfect now!

Quote:
Originally Posted by spk77 View Post
I think I finally got it working...set this as "global startup action" (this is needed for syncing)

Code:
local button_off_val = -21 -- This value is set when the button is "OFF"
local button_on_val = 90 -- This value is set when the button is "ON"

function main()
  local state = 0
  local delay = 0
  local is_new_value, filename, section_id, command_id, mode, resolution, val = reaper.get_action_context()
  local toggle_state = reaper.GetToggleCommandStateEx(section_id, command_id)
  if toggle_state == -1 then
    if reaper.HasExtState("musicbynumbers", "video output delay") then
      delay = tonumber(reaper.GetExtState("musicbynumbers", "video output delay"))
      if delay == button_on_val then
        state = 1
      else
        state = 0
      end
    else
      --reaper.ShowConsoleMsg("No ext state" .. "\n")
      state = 0
      delay = button_off_val
    end
  else
    if toggle_state == 1 then
      state = 0
      delay = button_off_val
    else
      state = 1
      delay = button_on_val
    end
  end
  reaper.SetToggleCommandState(section_id, command_id, state)
  reaper.RefreshToolbar2(section_id, command_id)
  reaper.SNM_SetIntConfigVar("video_delayms", delay)
  reaper.SetExtState("musicbynumbers", "video output delay", tostring(delay), true)
end

reaper.defer(main)
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 06-17-2018, 06:55 AM   #1670
shosty
Human being with feelings
 
Join Date: Aug 2015
Posts: 74
Default

I'm looking for a script that will a) add selected tracks to a new group and b) set one of the tracks to reverse pan.

For a) there is 'SWS/S&M: Set selected tracks to first unused group (default flags)'.

Is it possible for a script to do b)? Seems like it would be quite a simple thing but I wouldn't know where to start to write it.
shosty is offline   Reply With Quote
Old 06-20-2018, 05:01 PM   #1671
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,995
Default

Quote:
Originally Posted by Triode View Post
Hi!

I've been using this type of script to help shift-select groups of items across tracks (via folders or track groups). Since time selections are always made in my macros before that script the zero time selections are not an issue. Will post some examples to share when I get a spare bit of time. Thanks again
Sounds interesting, I will like to see them.
FnA is offline   Reply With Quote
Old 07-01-2018, 02:54 PM   #1672
timbralzoom
Human being with feelings
 
timbralzoom's Avatar
 
Join Date: Apr 2010
Location: Turkey/Istanbul
Posts: 1,482
Default

is this Action possible?
(or possible already but i just couldn't find it?)

Transpose Selected Notes Preserving Chord and Motive?
EDIT:
by Motive i mean Rhythmic Voicing actually .. i hope make sense

timbralzoom is offline   Reply With Quote
Old 07-03-2018, 03:08 AM   #1673
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 44
Default

Hi guys,

Is it possible to make a simple script that adds a new stereo hardware output to the selected track? I guess the name could be editable by the user in the script
reapero is offline   Reply With Quote
Old 07-03-2018, 03:17 AM   #1674
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,929
Default

Quote:
Originally Posted by reapero View Post
Hi guys,

Is it possible to make a simple script that adds a new stereo hardware output to the selected track? I guess the name could be editable by the user in the script
Code:
function createHardwareOut(output)
  for ti = 0, reaper.CountSelectedTracks()-1 do
    local track = reaper.GetSelectedTrack(0, ti)
    local send = reaper.CreateTrackSend(track, nil)
    reaper.SetTrackSendInfo_Value(track, 1, send, 'I_DSTCHAN', output)
  end
end

createHardwareOut(0) -- 0 = default output channel
cfillion is offline   Reply With Quote
Old 07-03-2018, 03:45 AM   #1675
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 44
Default

Jesuschrist! That was fast and efficient. Thanks a lot Cfillion!

I made a thread the other day on the general forum, regarding envelope takes, which hasnt been replied. This one : https://forum.cockos.com/showthread.php?t=208538

Do you think this is possible with scripting? Hiding take envelopes but keeping them active.

Cheers!
reapero 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 04:22 PM.


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