Script: X-Raym_Rename tracks with first VSTi and its preset name.lua - problem..
Hi folks,
I am very happy that there is a script to take the VSTi and it's preset name and rename the host track to that. This saves me a lot of keystrokes!
The script in question is "Script: X-Raym_Rename tracks with first VSTi and its preset name.lua"
Unfortunately it seems to have a limitation of around 24 characters for the preset name which is way too short for my needs.
I wonder if anyone out there could take a look at that script and see if it's easy to remove that limitation?
It's almost perfect!
Many thanks for any help/guidance you can offer.
-------
-- ------ USER CONFIG AREA =====>
separator = "-"
-- <===== USER CONFIG AREA ------
function main()
for i = 0, tracks_count - 1 do
track = reaper.GetSelectedTrack(0, i)
vsti_id = reaper.TrackFX_GetInstrument(track)
if vsti_id >= 0 then
retval, fx_name = reaper.TrackFX_GetFXName(track, vsti_id, "")
fx_name = fx_name:gsub("VSTi: ", "")
fx_name = fx_name:gsub(" %(.-%)", "")
retval, presetname = reaper.TrackFX_GetPreset(track, vsti_id, "")
if retval == 0 then
track_name_retval, track_name = reaper.GetSetMediaTrackInfo_String(track, "P_NAME", fx_name, true)
else
track_name_retval, track_name = reaper.GetSetMediaTrackInfo_String(track, "P_NAME", fx_name .. " " .. separator .. " " .. presetname, true)
end
end
end
end
-- INIT
tracks_count = reaper.CountSelectedTracks(0)
if tracks_count > 0 then
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock() -- Begining of the undo block. Leave it at the top of your main function.
main()
reaper.Undo_EndBlock("Rename tracks with first VSTi and its preset name", -1) -- End of the undo block. Leave it at the bottom of your main function.
reaper.PreventUIRefresh(-1)
end
Cheers
Thal
|