|
|
|
10-27-2020, 10:39 AM
|
#1
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Listing selected tracks in message box
As part of another LUA script I'd like to list all selected tracks' tracknames in a message box window.
Is this possible and how would I do this?
Thanks
|
|
|
10-27-2020, 11:08 AM
|
#2
|
Human being with feelings
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
|
One way or another?
PHP Code:
t = {} count_sel_tracks = reaper.CountSelectedTracks(0) if count_sel_tracks == 0 or count_sel_tracks > 16 then return end for i=0, count_sel_tracks-1 do local track_for_name = reaper.GetSelectedTrack(0,i) _, name_of_sel_track = reaper.GetSetMediaTrackInfo_String( track_for_name, 'P_NAME', 0, false) string_track_length = string.len(name_of_sel_track) if string_track_length > 22 then name_of_sel_track = string.sub(name_of_sel_track, 0, 16) .. '...'..string.sub(name_of_sel_track, string_track_length-4, string_track_length) elseif string_track_length == 0 then name_of_sel_track = "Track untitled "..i+1 end if i < count_sel_tracks-1 then table.insert(t,name_of_sel_track .. ',') else table.insert(t,name_of_sel_track) end end inputs_names = table.concat(t) local retval, retvals_csv = reaper.GetUserInputs('Show tracks names', count_sel_tracks, inputs_names, '') if retval then return else return end
Last edited by Yanick; 10-27-2020 at 12:17 PM.
|
|
|
10-27-2020, 11:30 AM
|
#3
|
Human being with feelings
Join Date: May 2020
Posts: 190
|
Alternatively you can just use this:
Code:
message = ""
for i = 0, reaper.CountSelectedTracks(0) - 1 do
local thisTrack = reaper.GetSelectedTrack(0, i)
local trackIndex = tostring(reaper.GetMediaTrackInfo_Value(thisTrack, "IP_TRACKNUMBER")):gsub("%.0", "")
local retval, trackName = reaper.GetTrackName(thisTrack)
message = message .. trackIndex .. " = " .. trackName .. "\n" --displays the actual track number (i.e. it is track #2 out of every track)
-- message = message .. i+1 .. " = " .. trackName .. "\n" --displays the selected track number (i.e. it is the second selected track)
end
if message:len() > 0 then reaper.ShowMessageBox("Selected Track Names:\n\n" .. message, "Selected Track Names", 0) end
|
|
|
10-27-2020, 11:39 AM
|
#4
|
Human being with feelings
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
|
Well, or so If you just show
|
|
|
10-27-2020, 11:40 AM
|
#5
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
That's brilliant. Thankyou both
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 07:15 PM.
|