Old 01-23-2021, 11:54 PM   #2361
kerryg
Human being with feelings
 
Join Date: Mar 2007
Posts: 338
Default

Quote:
Originally Posted by kerryg View Post
Just as a response to my own request - I’ve stumbled across some great scripts by David Healy and will be testing soon: https://github.com/davidhealey/reascript/find/master
OK - I've had a look at this collection here and although it looks perfect I can't really make heads nor tails of it. I've downloaded it from GitHub and dropped it into all the directories as per instructions and I'm not seeing how to make it work.

This leaves me with a few possibilities:
1) they're developed for an earlier version and won't work with V6 without modification
2) I've done something wrong on the install
3) they're working properly and I just haven't figured out how to turn them on/run them

Any thoughts?
kerryg is offline   Reply With Quote
Old 01-24-2021, 01:40 PM   #2362
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 350
Default

Quote:
Originally Posted by Loulou92 View Post
Hello !

Could someone come up with an alternative version of :

SWS/S&M: Copy selected tracks routings
SWS/S&M: Paste routings to selected tracks

that also copy and paste the parent send ticked/unticked status ? Right now the SWS actions copy and paste the sends and receives, but not the parent send status. I need to copy / paste everything at the same time .

Alternatively, I could do with a smaller script that copy and paste the parent send status on its own, and not the sends and receives. I'd use these two scripts along the SWS actions to get the same expected end result.

I'll consider a donation, as this duo of script would be very convenient for my workflow !!

Good evening !
xxxxxxxxxx
Louis
I went with the second route... Scripts are meant to be used together as a pair. I don't want any kind of donation, but if you feel like it, please consider donating something to a charity that has meaning to you.
Attached Files
File Type: lua TJF Copy Track MasterParent Send.lua (204 Bytes, 18 views)
File Type: lua TJF Paste Track MasterParent Send.lua (381 Bytes, 22 views)
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 01-24-2021, 09:27 PM   #2363
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Working perfectly, thank you ! Greenpeace it is then .
Loulou92 is offline   Reply With Quote
Old 01-26-2021, 04:50 PM   #2364
mattn
Human being with feelings
 
mattn's Avatar
 
Join Date: Aug 2020
Location: Hamburg
Posts: 46
Default Why does my script not work to add FX to item?

What is wrong with this script, can somebody more knowledgable than me test it?
When I run it (one item is selected), nothing happens...
I want to add Melodyne to an item and the GUI of Melodyne should open up.
Thanks for any help!!

code:
reaper.Undo_BeginBlock()
local FX = "VST3:Melodyne (Celemony)"

local item = reaper.GetSelectedMediaItem(0 ,0)
if not item then
reaper.ShowMessageBox("Please select one or more items.", "Script Processing", 0)
return
end

count_items = reaper.CountSelectedMediaItems(0)


if count_items < 2 then
local item = reaper.GetSelectedMediaItem(0 ,0)
MediaItem_Take = reaper.GetTake(item, 0)
reaper.TakeFX_AddByName(MediaItem_Take, "FX", 1)
return
end

if count_items > 1 then
local ret = reaper.ShowMessageBox("More than 1 item selected - insert FX?", "ACHTUNG BABY!", 1)
if ret == 1 then -- user pressed OK in dialog
for i = 0, count_items-1 do
local item = reaper.GetSelectedMediaItem(0 ,i)
MediaItem_Take = reaper.GetTake(item, 0)
reaper.TakeFX_AddByName(MediaItem_Take, "FX", 1)
end
local act = "_S&M_WNCLS5" --close fx windows again
if string.sub(act, 1, 1) == "_" then
act = reaper.NamedCommandLookup(act)
end
act = tonumber(act)
if act and act > 0 then
reaper.Main_OnCommand(act, 0)
end
end
end
reaper.Undo_EndBlock("Insert item FX", 0)
__________________
www.studiohoell.de
mattn is offline   Reply With Quote
Old 01-27-2021, 01:09 AM   #2365
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default [SOLVED] Toggle "in use" envelope tracks visibility for all selected tracks

Hello

I'd need a script like this

"Toggle "in use" envelope tracks visibility for all selected tracks"

I need this because Archie script "remove content of time selection on selected tracks" doesn't remove the hidden envelopes. So with the script I'm asking here, I could use the Archie script a first time, toggle, use the archie script a second time, toggle again, and then I'd end up with a content removal that has also worked on *hidden envelope tracks*.

So the script request, it would toggle the visibility of any envelope track that has content on it : automation items, envelopes...

Hoepfully this makes sense and is do-able.

As always, I'll consider a little donation if you're so inclined !!!


(and yes I also asked to Archie, but no answers yet, the man/girl is probably busy scripting the next big thing ^^')

xxxxxxxxxxxxxxxxxx
Louis

Last edited by Loulou92; 01-30-2021 at 12:24 PM.
Loulou92 is offline   Reply With Quote
Old 01-27-2021, 03:52 AM   #2366
mattn
Human being with feelings
 
mattn's Avatar
 
Join Date: Aug 2020
Location: Hamburg
Posts: 46
Default

Have a look here and see if it helps. Edgemeal made a little script that shows all tracks that contain at least one envelope. You will have to edit it to adapt it to your needs, but it might get you in the right direction!

https://forum.cockos.com/showpost.ph...postcount=2101


Quote:
Originally Posted by Loulou92 View Post
Hello

I'd need a script like this

"Toggle "in use" envelope tracks visibility for all selected tracks"

I need this because Archie script "remove content of time selection on selected tracks" doesn't remove the hidden envelopes. So with the script I'm asking here, I could use the Archie script a first time, toggle, use the archie script a second time, toggle again, and then I'd end up with a content removal that has also worked on *hidden envelope tracks*.

So the script request, it would toggle the visibility of any envelope track that has content on it : automation items, envelopes...

Hoepfully this makes sense and is do-able.

As always, I'll consider a little donation if you're so inclined !!!


(and yes I also asked to Archie, but no answers yet, the man/girl is probably busy scripting the next big thing ^^')

xxxxxxxxxxxxxxxxxx
Louis
__________________
www.studiohoell.de
mattn is offline   Reply With Quote
Old 01-27-2021, 04:24 AM   #2367
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Thanks mattn !
Aside from basic IF / Else if things, I can't write scripts. I paste formulas and change values here and there but nothing fancy... I tried for a bit but it's not my thing so I'm not sure I'll make anything out of your suggestion (+, from my understanding, it's not strictly related ; what I look for is to toggle visibility for all active envelope tracks of all selected tracks).


Edit : X-Raym is working on something via his script design service
Edit 2 : X-Raym_Delete automation items in time selection.lua (modify user config to delete hidden items)

Last edited by Loulou92; 01-30-2021 at 12:23 PM.
Loulou92 is offline   Reply With Quote
Old 01-27-2021, 07:17 AM   #2368
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 350
Default

Quote:
Originally Posted by mattn View Post
What is wrong with this script, can somebody more knowledgable than me test it?
When I run it (one item is selected), nothing happens...
I want to add Melodyne to an item and the GUI of Melodyne should open up.
Thanks for any help!!

code:
reaper.Undo_BeginBlock()
local FX = "VST3:Melodyne (Celemony)"

local item = reaper.GetSelectedMediaItem(0 ,0)
if not item then
reaper.ShowMessageBox("Please select one or more items.", "Script Processing", 0)
return
end

count_items = reaper.CountSelectedMediaItems(0)


if count_items < 2 then
local item = reaper.GetSelectedMediaItem(0 ,0)
MediaItem_Take = reaper.GetTake(item, 0)
reaper.TakeFX_AddByName(MediaItem_Take, "FX", 1)
return
end

if count_items > 1 then
local ret = reaper.ShowMessageBox("More than 1 item selected - insert FX?", "ACHTUNG BABY!", 1)
if ret == 1 then -- user pressed OK in dialog
for i = 0, count_items-1 do
local item = reaper.GetSelectedMediaItem(0 ,i)
MediaItem_Take = reaper.GetTake(item, 0)
reaper.TakeFX_AddByName(MediaItem_Take, "FX", 1)
end
local act = "_S&M_WNCLS5" --close fx windows again
if string.sub(act, 1, 1) == "_" then
act = reaper.NamedCommandLookup(act)
end
act = tonumber(act)
if act and act > 0 then
reaper.Main_OnCommand(act, 0)
end
end
end
reaper.Undo_EndBlock("Insert item FX", 0)
This bit: reaper.TakeFX_AddByName(MediaItem_Take, "FX", 1)

FX is a variable... remove the quotes around it to call the variable. By having the quotes you are calling a string inside the quotes...literally trying to add a plug-in called “FX”
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 01-30-2021, 02:39 AM   #2369
mattn
Human being with feelings
 
mattn's Avatar
 
Join Date: Aug 2020
Location: Hamburg
Posts: 46
Default

Quote:
Originally Posted by sonictim View Post
This bit: reaper.TakeFX_AddByName(MediaItem_Take, "FX", 1)

FX is a variable... remove the quotes around it to call the variable. By having the quotes you are calling a string inside the quotes...literally trying to add a plug-in called “FX”
Ah ok! Thank you Sonitim, that worked!! :-)
__________________
www.studiohoell.de
mattn is offline   Reply With Quote
Old 01-31-2021, 02:40 AM   #2370
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default Why doesn't this script work when zoomed in past a certain range?

At normal zoom levels, it works fine. But as horizontal zoom gets closer to seeing individual samples (and beyond), the cursor position will end up somewhere way off screen instead of in the middle of the view.
Code:
local r = reaper
function ZoomInAndCenterEditCursor()
  r.Main_OnCommand(1012, 0) -- View: Zoom in horizontal
  local trackview = r.JS_Window_FindChildByID(r.GetMainHwnd(), 1000)
  local infoOK, scrollPos, pageSize, min, max, trackPos = r.JS_Window_GetScrollInfo(trackview, "HORZ")
  local cursorTime = r.GetCursorPositionEx(0) -- Always counted from start of project, ignores "Project start time"
  local zoom = r.GetHZoomLevel() -- returns pixels/second
  local cursorPixels = cursorTime*zoom
  local newScrollPos = math.floor(cursorPixels - pageSize*0.38) -- float value for percent of view (from left side), 0.38 is about in the center of the monitor
  r.JS_Window_SetScrollPos(trackview, "HORZ", newScrollPos)
end
earhax is online now   Reply With Quote
Old 01-31-2021, 02:47 AM   #2371
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default Script to generate a list of unused/unmapped keyboard shortcuts?

Does such a script exist? If not, would it be possible to somehow read the keyboard shortcut data from the reaper-kb.ini, parse and compare it with a list of all possible shortcut key combinations, and generate a list of all unused/unmapped shortcuts?

On Mac, there are 4 modifiers, so each key has 16 possible shortcuts for it.

e.g.
Space
Shift+Space
Cmd+Space
Cmd+Shift+Space
Opt+Space
Opt+Shift+Space
Cmd+Opt+Space
Cmd+Opt+Shift+Space
Ctrl+Space
Shift+Ctrl+Space
Cmd+Ctrl+Space
Cmd+Shift+Ctrl+Space
Opt+Ctrl+Space
Opt+Shift+Ctrl+Space
Cmd+Opt+Ctrl+Space
Cmd+Opt+Shift+Ctrl+Space
earhax is online now   Reply With Quote
Old 01-31-2021, 08:29 AM   #2372
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

+1 for the request just above : Very useful to determine what shortcuts are free to use with a Stream Deck.
Loulou92 is offline   Reply With Quote
Old 02-02-2021, 11:57 AM   #2373
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default

Quote:
Originally Posted by earhax View Post
At normal zoom levels, it works fine. But as horizontal zoom gets closer to seeing individual samples (and beyond), the cursor position will end up somewhere way off screen instead of in the middle of the view.
Code:
local r = reaper
function ZoomInAndCenterEditCursor()
  r.Main_OnCommand(1012, 0) -- View: Zoom in horizontal
  local trackview = r.JS_Window_FindChildByID(r.GetMainHwnd(), 1000)
  local infoOK, scrollPos, pageSize, min, max, trackPos = r.JS_Window_GetScrollInfo(trackview, "HORZ")
  local cursorTime = r.GetCursorPositionEx(0) -- Always counted from start of project, ignores "Project start time"
  local zoom = r.GetHZoomLevel() -- returns pixels/second
  local cursorPixels = cursorTime*zoom
  local newScrollPos = math.floor(cursorPixels - pageSize*0.38) -- float value for percent of view (from left side), 0.38 is about in the center of the monitor
  r.JS_Window_SetScrollPos(trackview, "HORZ", newScrollPos)
end
Seriously hope someone with more script skills than me can answer this. It's driving me nuts losing the cursor from the screen when zooming in past a certain point.
earhax is online now   Reply With Quote
Old 02-02-2021, 12:01 PM   #2374
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default

Would it be possible to script the toggling of the Reaper preferences setting "show project regions/markers in grid"?

Normally, I want them displayed. But with larger projects that have a ton of markers, when zoomed out far enough, all I can see are the markers - even with the "under items" option chosen for marker line Z order. So if I can script this show/hide option to automatically toggle at a certain zoom depth, that would be ideal.
earhax is online now   Reply With Quote
Old 02-02-2021, 12:42 PM   #2375
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,243
Default

Quote:
Originally Posted by earhax View Post
Would it be possible to script the toggling of the Reaper preferences setting "show project regions/markers in grid"?
Code:
reaper.Main_OnCommand(42328, 0) -- Ruler: Display project regions/markers as gridlines in arrange view
Or see,
https://mespotin.uber.space/Ultrasch...ml#rulerlayout

Code:
reaper.SNM_SetIntConfigVar('rulerlayout', reaper.SNM_GetIntConfigVar('rulerlayout', -666)~32)
reaper.UpdateArrange()

Last edited by Edgemeal; 02-02-2021 at 12:50 PM.
Edgemeal is offline   Reply With Quote
Old 02-05-2021, 11:04 PM   #2376
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Hey

I'm looking for a pair of script that would copy/paste the selected track's selected FX Wet-Dry %.

- Copy selected track's selected FX Wet-Dry setting
- Paste Wet-Dry setting to selected FX of selected track

The Wet-Dry setting I talk about is the one that we have in the upper right corner of the FX Window, the Reaper setting. Not the setting you find embedded in most plugins.

It would be very useful to have, here !!
Any help appreciated .
xxxxxxxxxxxxx
Loulou92 is offline   Reply With Quote
Old 02-06-2021, 11:02 AM   #2377
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,243
Default

Quote:
Originally Posted by Loulou92 View Post
I'm looking for a pair of script that would copy/paste the selected track's selected FX Wet-Dry %.
Slapped this together from my other scripts + some code by amagalma (see his Wet script on reapack), hope it works, I didn't really test it...

Code:
-- Paste wet value to focused track FX

function SetFxWet()
  local track
  local retval, track_id, _, fx = reaper.GetFocusedFX()
  if retval > 0 then 
    if track_id == 0 then
      track = reaper.GetMasterTrack(0)
    else
     track = reaper.CSurf_TrackFromID(track_id, false)
    end
  else
    reaper.MB('Please set focus on track FX','Paste wet value to focused track FX',0)
    return
  end -- Set wet value
  local num = tonumber(reaper.GetExtState("FxValue", "Wet"))
  if num ~= nil then
    reaper.TrackFX_SetParam(track, fx, reaper.TrackFX_GetNumParams(track,fx)-1, num/100)
  end  
end

SetFxWet()
reaper.defer(function () end)
Code:
-- Copy focused track FX wet value

function round(num, numDecimalPlaces)
  local mult = 10^(numDecimalPlaces or 0)
  if num >= 0 then return math.floor(num * mult + 0.5) / mult
  else return math.ceil(num * mult - 0.5) / mult end
end

function GetFocusedFxWet()
  local track
  local retval, track_id, _, fx = reaper.GetFocusedFX() 
  if retval > 0 then 
    if track_id == 0 then
      track = reaper.GetMasterTrack(0)
    else
     track = reaper.CSurf_TrackFromID(track_id, false) 
    end 
  else 
    return
  end -- get Wet value (last param in fx parm list)
  local num = reaper.TrackFX_GetParamNormalized(track,fx,reaper.TrackFX_GetNumParams(track,fx)-1)
  return(round(num * 100))
end

local val = GetFocusedFxWet()
if val ~= nil then
  reaper.SetExtState("FxValue", "Wet", tostring(val), false)
else
  reaper.MB('Please set focus on track FX','Copy focused track FX wet value',0)
end
reaper.defer(function () end)
Edgemeal is offline   Reply With Quote
Old 02-06-2021, 05:11 PM   #2378
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

A first quick test says it works just as expected. Thank you (again) Edgemeal !

Edit : is there a difference between "focused" fx and "selected" fx in Reaper ? The script doesn't seem to cooperate if the the copy paste occurs during a cycle action. If I do it manually with the FX window open, then no problem thought.

Edit : argh, ok, so the script works if I execute the sequence of actions manually via the action list, but inside a cycle action, the 2 scripts keep asking "to set a focus on track fx" (even if I use actions such as "select last fx in selected track" "show fx chain for selected track" etc to make sure the FX is visible, selected, and in focus).

Last edited by Loulou92; 02-06-2021 at 06:52 PM.
Loulou92 is offline   Reply With Quote
Old 02-06-2021, 07:18 PM   #2379
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,243
Default

I never used cycle actions so have no clue, hopefully someone else can help.
Edgemeal is offline   Reply With Quote
Old 02-06-2021, 07:24 PM   #2380
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

--> because the arrange view isn't updated during the cycle action the scripts don't catch the fx focus.
Loulou92 is offline   Reply With Quote
Old 02-07-2021, 07:16 AM   #2381
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Edgemeal

Would it be possible to make a script that doesn't work on the "focused" fx, but rather works on a FX with a specific name on the selected track, for example "XYZ". That would solve my problem.

copy wet value of FX "XYZ" on selected track
&
paste wet value to FX "XYZ" on selected track

If it's too tedious or something, or it's too far off what Amagalma has initially done... Don't bother .
Loulou92 is offline   Reply With Quote
Old 02-07-2021, 09:17 AM   #2382
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,243
Default

Quote:
Originally Posted by Loulou92 View Post
Would it be possible to make a script that doesn't work on the "focused" fx, but rather works on a FX with a specific name on the selected track, for example "XYZ". That would solve my problem.
Give this a try, it only for 1st selected track, use fx name as seen in the fx chain window,..

Code:
-- Paste wet value to selected track FX

local source_fx = "VST: ReaComp (Cockos)" -- < Set Name of FX

function SetSelTrackFxWet()
  local track = reaper.GetSelectedTrack(0,0)
  if track == nil then return end

  local fx_count = reaper.TrackFX_GetCount(track)
  for fx = 0, fx_count-1 do
    local r, fx_name = reaper.TrackFX_GetFXName(track, fx, "")
    if fx_name == source_fx then
      local num = tonumber(reaper.GetExtState("FxValue", "Wet"))
      if num ~= nil then
        reaper.TrackFX_SetParam(track, fx, reaper.TrackFX_GetNumParams(track,fx)-1, num/100)
      end
      break -- Exit loop - To set all matching fx remove this line.
    end
  end
end

SetSelTrackFxWet()
reaper.defer(function () end)

Code:
-- Copy selected track FX wet value

local source_fx = "VST: ReaComp (Cockos)" -- < Set Name of FX

function round(num, numDecimalPlaces)
  local mult = 10^(numDecimalPlaces or 0)
  if num >= 0 then return math.floor(num * mult + 0.5) / mult
  else return math.ceil(num * mult - 0.5) / mult end
end

function GetSelTrackFxWet()
  local track = reaper.GetSelectedTrack(0,0)
  if track == nil then return end

  local fx_count = reaper.TrackFX_GetCount(track)
  for fx = 0, fx_count-1 do
    local r, fx_name = reaper.TrackFX_GetFXName(track, fx, "")
    if fx_name == source_fx then
      local num = reaper.TrackFX_GetParamNormalized(track,fx,reaper.TrackFX_GetNumParams(track,fx)-1)
      return(round(num * 100))
    end
  end
end

local val = GetSelTrackFxWet()
if val ~= nil then
  reaper.SetExtState("FxValue", "Wet", tostring(val), false)
end
reaper.defer(function () end)
Edgemeal is offline   Reply With Quote
Old 02-07-2021, 07:10 PM   #2383
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Victory man, it totally works ! Thank you !!!!!! Game changer here. Paypaling you right now.
Loulou92 is offline   Reply With Quote
Old 02-10-2021, 04:19 PM   #2384
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default

Quote:
Originally Posted by Edgemeal View Post
Code:
reaper.Main_OnCommand(42328, 0) -- Ruler: Display project regions/markers as gridlines in arrange view
Or see,
https://mespotin.uber.space/Ultrasch...ml#rulerlayout

Code:
reaper.SNM_SetIntConfigVar('rulerlayout', reaper.SNM_GetIntConfigVar('rulerlayout', -666)~32)
reaper.UpdateArrange()
Thank you!

Haha! Of course there's a native action for this that I just didn't happen to find when I searched for "show markers OR toggle markers OR hide markers". If only the action for this used the same lexicon as the setting in preferences (i.e. "show project regions/markers in grid" instead of "Ruler: Display project regions/markers as gridlines in arrange view").

Oh how I wish the actions list search supported RegEx or had a built-in thesaurus for search terms so I could avoid embarrassing mishaps like this.

I think from now on I'll stick with searching the exported actions list as a text file in Sublime Text so I can use RegEx to search for actions. Won't be able to run them as quickly that way, but at least it'll be easier to find stuff and avoid missing things.

Note to self: TODO: write a script that supports RegEx queries that will search through all available action/script names and bring up the results in the actions window, including an editable thesaurus of commonly used synonyms.
earhax is online now   Reply With Quote
Old 02-10-2021, 04:44 PM   #2385
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default

Quote:
Originally Posted by earhax View Post
At normal zoom levels, it works fine. But as horizontal zoom gets closer to seeing individual samples (and beyond), the cursor position will end up somewhere way off screen instead of in the middle of the view.
Code:
local r = reaper
function ZoomInAndCenterEditCursor()
  r.Main_OnCommand(1012, 0) -- View: Zoom in horizontal
  local trackview = r.JS_Window_FindChildByID(r.GetMainHwnd(), 1000)
  local infoOK, scrollPos, pageSize, min, max, trackPos = r.JS_Window_GetScrollInfo(trackview, "HORZ")
  local cursorTime = r.GetCursorPositionEx(0) -- Always counted from start of project, ignores "Project start time"
  local zoom = r.GetHZoomLevel() -- returns pixels/second
  local cursorPixels = cursorTime*zoom
  local newScrollPos = math.floor(cursorPixels - pageSize*0.38) -- float value for percent of view (from left side), 0.38 is about in the center of the monitor
  r.JS_Window_SetScrollPos(trackview, "HORZ", newScrollPos)
end
Bumping this one. It's driving me nuts!

Can anyone please help me to figure out why this isn't working properly so I can get the cursor always positioned at 38% from the left side of the arrange view regardless of horizontal zoom level?

I have a nice set of scripts I made for managing horizontal focus and different zoom presets. If I could just get this one thing fixed it would be ready to release!

Thanks!
earhax is online now   Reply With Quote
Old 02-10-2021, 04:48 PM   #2386
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default

Quote:
Originally Posted by earhax View Post
Does such a script exist? If not, would it be possible to somehow read the keyboard shortcut data from the reaper-kb.ini, parse and compare it with a list of all possible shortcut key combinations, and generate a list of all unused/unmapped shortcuts?

On Mac, there are 4 modifiers, so each key has 16 possible shortcuts for it.

e.g.
Space
Shift+Space
Cmd+Space
Cmd+Shift+Space
Opt+Space
Opt+Shift+Space
Cmd+Opt+Space
Cmd+Opt+Shift+Space
Ctrl+Space
Shift+Ctrl+Space
Cmd+Ctrl+Space
Cmd+Shift+Ctrl+Space
Opt+Ctrl+Space
Opt+Shift+Ctrl+Space
Cmd+Opt+Ctrl+Space
Cmd+Opt+Shift+Ctrl+Space
And bump on this one too. I don't have a Stream Deck, so I'm stuck just using a boring old USB keyboard still, and am running out of easy to find shortcuts!

For either this or the horizontal zoom issue I'd happily donate to PayPal for anyone who can help.

Thanks!
earhax is online now   Reply With Quote
Old 02-11-2021, 01:21 AM   #2387
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Hello !

Sorry, I still have a few requests left...

"Copy selected track mixer fader volume value.lua"
&
"Paste saved mixer fader volume value to selected track.lua"

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

"Toggle track width envelope active on selected track.lua"

Edgemeal has delivered a great script that works on "visible" instead of "active". I tried to mod the script to make it work on "active" but it doesn't work :/. The mod deactivates the width envelope (in my config, the envelope then disappears, it's an option IIRC). Problem : another run of the script mod doesn't seem to turn the envelope active again.

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

I have other requests that I suspect are more difficult so I'll ask these to X-Raym.

Any help appreciated, as always !!
Loulou92 is offline   Reply With Quote
Old 02-11-2021, 02:30 AM   #2388
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 793
Default Unnamed Track Auto-Renaming Script

Would it be possible to have a script that runs in the background and automatically renames unnamed tracks when a virtual instrument is added to it? For example as soon as I add an instance of Kontakt to an unnamed track the track name turns to "Kontakt"?

Less important but would also be cool:

When dragging a media item from one track to another unnamed/new track the track is named after the media source file (like preferences > media 'Automatically name unnamed tracks on media import' does but working also for media items which are already inside the project).

Have a dummy name for unnamed tracks (ideally "Track 1", "Track 2"... "Track 12".. based on track index number but if not possible also just "Track" is fine) which gets overwritten as soon as it is either manually renamed, or an instrument is added, or a media file is imported / item is placed onto it.


Even if someone makes only 1 of any of these I would be very grateful.
Phazma is offline   Reply With Quote
Old 02-11-2021, 09:37 AM   #2389
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,243
Default

Quote:
Originally Posted by Loulou92 View Post
"Copy selected track mixer fader volume value.lua"
&
"Paste saved mixer fader volume value to selected track.lua"
Whats a mixer fader volume? This is just plain old track volume..

Code:
-- Copy selected track volume
local track = reaper.GetSelectedTrack(0,0)
if track ~= nil then
  local val = reaper.GetMediaTrackInfo_Value(track, "D_VOL")
  reaper.SetExtState("SelTrack", "Vol", tostring(val), false)
end
Code:
-- Paste volume to selected track
local track = reaper.GetSelectedTrack(0,0)
if track ~= nil then
  local num = tonumber(reaper.GetExtState("SelTrack", "Vol")) 
  if num ~= nil then reaper.SetMediaTrackInfo_Value(track, "D_VOL", num) end
end
Quote:
"Toggle track width envelope active on selected track.lua"
PM Sent.

Last edited by Edgemeal; 02-11-2021 at 12:15 PM.
Edgemeal is offline   Reply With Quote
Old 02-11-2021, 10:26 AM   #2390
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Yes, the correct term is track volume ^^.

Thanks Edgemeal, the two scripts work perfectly.

I'm so close to being done. 1052 cycle actions. Reaper is great, but it makes the user work hard.
Loulou92 is offline   Reply With Quote
Old 02-11-2021, 12:21 PM   #2391
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 2,794
Default

Quote:
Originally Posted by earhax View Post
Bumping this one. It's driving me nuts!

Can anyone please help me to figure out why this isn't working properly so I can get the cursor always positioned at 38% from the left side of the arrange view regardless of horizontal zoom level?

I have a nice set of scripts I made for managing horizontal focus and different zoom presets. If I could just get this one thing fixed it would be ready to release!

Thanks!

It seems to work here.. But it's not the best way to do it, since Reaper has native API for this.. Look at my zoom presets scripts in Reapack
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 02-11-2021, 11:44 PM   #2392
Pink Wool
Human being with feelings
 
Pink Wool's Avatar
 
Join Date: Apr 2020
Posts: 281
Default

Quote:
Originally Posted by Phazma View Post
Would it be possible to have a script that runs in the background and automatically renames unnamed tracks when a virtual instrument is added to it? For example as soon as I add an instance of Kontakt to an unnamed track the track name turns to "Kontakt"?
That would be nice!
Pink Wool is online now   Reply With Quote
Old 02-16-2021, 01:01 PM   #2393
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default Move FX named "XYZ" to position "n" in selected track(s).lua

Hello
I need to do this in a bunch of cycle actions I try to finish :

"Move FX named "XYZ" to position "n" in selected track(s).lua"

Would that be something possible in script ? I'll consider a little donation if someone comes up with a solution !

xxxxxxxxxxxxxx
Loulou92 is offline   Reply With Quote
Old 02-16-2021, 01:32 PM   #2394
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,243
Default

Quote:
Originally Posted by Loulou92 View Post
"Move FX named "XYZ" to position "n" in selected track(s).lua"
Something like,..?
Code:
function MoveTrackFx(fx_name, index)
  local selected_tracks = reaper.CountSelectedTracks(0)
  for i = 0, selected_tracks - 1  do
    local track = reaper.GetSelectedTrack(0, i)
    for fx = 0, reaper.TrackFX_GetCount(track)-1 do
      local _, name = reaper.TrackFX_GetFXName(track, fx, "")    
      if name == fx_name then
        reaper.TrackFX_CopyToTrack(track, fx, track, index, true)
        break
      end    
    end
  end
end

-- move ReaComp on selected tracks to index zero (top of list)
MoveTrackFx("VST: ReaComp (Cockos)", 0)
Edgemeal is offline   Reply With Quote
Old 02-16-2021, 03:36 PM   #2395
Loulou92
Human being with feelings
 
Loulou92's Avatar
 
Join Date: Sep 2015
Location: Paris
Posts: 254
Default

Yes it works . Thank you very much ! I'll paypal you a little something tomorrow.
xxxxxxxxxxxxxxxxxxxxxx
Loulou92 is offline   Reply With Quote
Old 02-18-2021, 02:44 AM   #2396
Pink Wool
Human being with feelings
 
Pink Wool's Avatar
 
Join Date: Apr 2020
Posts: 281
Default

Is there a script that I could use to add an FX to a track (via toolbar icon) and if no track is selected, it would add a new track with the selected FX? Or if there isn't would this be hard to script?

Thanks in advance!
Pink Wool is online now   Reply With Quote
Old 02-18-2021, 03:22 AM   #2397
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 793
Default

Quote:
Originally Posted by Pink Wool View Post
Is there a script that I could use to add an FX to a track (via toolbar icon) and if no track is selected, it would add a new track with the selected FX? Or if there isn't would this be hard to script?

Thanks in advance!
I am no scripter so I sadly can't offer a solution but there are the 2 actions "View: Show FX browser window" and "Insert virtual instrument on new track...". A script would thus only need to detect if a track is selected and run the first action if selection is active and the second if inactive.
If using the cycle action editor probably even only the detect-track-selection part is necessary. Maybe there is already something in the actionlist or reapack but I am sure that this is very easy to script with 1 or 2 lines of code.
Phazma is offline   Reply With Quote
Old 02-18-2021, 05:40 AM   #2398
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 1,844
Default

You can look for a selected track and insert it the FX in it or this is out of another script to insert new track and add FX.
Code:
      commandID1 = reaper.NamedCommandLookup("_XENAKIOS_INSNEWTRACKTOP") -- Xenakios/SWS: Insert new track at the top of track list
      reaper.Main_OnCommand(commandID1, 0) -- Xenakios/SWS: Insert new track at the top of track list
      
      seltrack = reaper.GetTrack( 0, 0 )
      
      reaper.SetTrackSelected( seltrack, 1 )
      
      seltrack = reaper.GetSelectedTrack2( 0, 0, 1 )
      
      reaper.TrackFX_AddByName( seltrack, "ReaTrak note-counter.jsfx", 0, -1 )
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
MusoBob is offline   Reply With Quote
Old 02-19-2021, 02:28 AM   #2399
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 793
Default Set Project Framerate from Video

Anyone wants to make a script that sets the project framerate to be equal to the video framerate?

Any way works, either from selected video item, or first imported video item or video item on highest track (lowest track idx number).
Phazma is offline   Reply With Quote
Old 02-20-2021, 12:35 PM   #2400
earhax
Human being with feelings
 
earhax's Avatar
 
Join Date: Nov 2015
Posts: 352
Default

Is there a script (in ReaPack or otherwise) for randomizing selected envelope point values within a defined min/max value range? I keep trying to find one, but can't.

The closest thing I found is the ReaTeam script js_Envelope LFO generator and shaper. But that isn't really built for simply randomizing only selected envelope points, and is kind of tedious to get the random values within the right range. Also, the randomization comes out with the same values every time, so it's not really true random.

If I could find a tool for this, it would save me a ton of time right now. So hopefully someone knows of one, and it works for take envelopes!

Also, I found a bug with that ReaTeam script: it doesn't take into account the REAPER settings for amplitude scaling/volume fader scaling, or Volume envelope range.

I don't use the defaults (volume fader scaling & -inf..+24dB instead of amplitude scaling & -inf..+6dB), so the center value is always off, and getting the low and high values for the LFO to scale from the center value evenly doesn't work properly.

Last edited by earhax; 02-20-2021 at 12:40 PM. Reason: more info
earhax is online now   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 12:44 PM.


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