Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-02-2018, 10:20 AM   #1
Thalamus
Human being with feelings
 
Thalamus's Avatar
 
Join Date: Jun 2011
Location: Cheshire, UK
Posts: 607
Default 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
Thalamus is offline   Reply With Quote
Old 05-02-2018, 12:05 PM   #2
Thalamus
Human being with feelings
 
Thalamus's Avatar
 
Join Date: Jun 2011
Location: Cheshire, UK
Posts: 607
Default

Ah, TrackFX_GetPreset has the limitation:

https://forum.cockos.com/showthread.php?t=140181
Thalamus is offline   Reply With Quote
Old 05-03-2018, 03:56 AM   #3
Thalamus
Human being with feelings
 
Thalamus's Avatar
 
Join Date: Jun 2011
Location: Cheshire, UK
Posts: 607
Default

Little update on this..

It seems that the get preset name can work fine (without the character count limitation) with every plugin I try except Kontakt (which, sadly, is the one I'm trying to get working).
Thalamus 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 08:31 AM.


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