Old 08-18-2018, 06:14 PM   #1
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default Insert/Show FX on Selected Tracks

Hey guys,

This is an awesome script template by Spk77 which I adapted to my specific need.
It will insert the FX on the selected track if it doesnt already exist or open/show it if it does.

Now I'd like to expand the feature to be able to apply this to all Selected Tracks at once.

Can someone please help me I don't know enough to figure it out alone.

Thanks in advance

Code:
local FX_name = {"FabFilter Pro-Q 2"}--Change plugin FX name between "" to load your desired FX

function
InsertShow_FX_name()
  local selectedtrack = reaper.GetSelectedTrack2(0, 0, true)
  for status_fx_on=1, #FX_name do
    local fx_loop = reaper.TrackFX_AddByName(selectedtrack, FX_name[status_fx_on], false, 1)
    reaper.TrackFX_SetOpen(selectedtrack, fx_loop, not reaper.TrackFX_GetOpen(selectedtrack, fx_loop))
  end
end

InsertShow_FX_name()--end of function
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 08-18-2018, 06:29 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

Code:
local effects = {
  "FabFilter Pro-Q 2",
}

for i=0, reaper.CountSelectedTracks(0)-1 do
  local track = reaper.GetSelectedTrack(0, i)

  for _, effect in ipairs(effects) do
    local index = reaper.TrackFX_AddByName(track, effect, false, 1)
    reaper.TrackFX_SetOpen(track, index, not reaper.TrackFX_GetOpen(track, index))
  end
end
cfillion is offline   Reply With Quote
Old 08-18-2018, 06:35 PM   #3
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by cfillion View Post
Code:
local effects = {
  "FabFilter Pro-Q 2",
}

for i=0, reaper.CountSelectedTracks(0)-1 do
  local track = reaper.GetSelectedTrack(0, i)

  for _, effect in ipairs(effects) do
    local index = reaper.TrackFX_AddByName(track, effect, false, 1)
    reaper.TrackFX_SetOpen(track, index, not reaper.TrackFX_GetOpen(track, index))
  end
end
Wow. 15 minutes later and it works perfect. Thanks so much! Donated for a beer

EDIT: wow again, I just realised that the comma after "pro-q 2" actually allows you to pair multiple FX!! Thats very handy man. Genious
__________________
Alex | www.drocksrecords.com | Thanks for REAPER

Last edited by D Rocks; 08-18-2018 at 06:43 PM.
D Rocks is offline   Reply With Quote
Old 08-18-2018, 06:43 PM   #4
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

You're welcome, and thank you!

(The original script already supported adding multiple effects)
cfillion is offline   Reply With Quote
Old 08-18-2018, 06:49 PM   #5
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Quote:
Originally Posted by cfillion View Post
You're welcome, and thank you!

(The original script already supported adding multiple effects)
Oh so its an array I suppose? Thanks to that left over comma which made me understand with the help of how you carefully named your values "effect, effects, i and ipairs"
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks 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 02:57 PM.


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