Old 10-27-2020, 10:39 AM   #1
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default 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
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Old 10-27-2020, 11:08 AM   #2
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

One way or another?
PHP Code:
    
    t 
= {}
    
count_sel_tracks reaper.CountSelectedTracks(0)
    if 
count_sel_tracks == or count_sel_tracks 16 then return end
    
for i=0count_sel_tracks-do
      
local track_for_name reaper.GetSelectedTrack(0,i)
      
_name_of_sel_track reaper.GetSetMediaTrackInfo_Stringtrack_for_name'P_NAME'0false)
      
string_track_length string.len(name_of_sel_track)
      if 
string_track_length 22 then
        name_of_sel_track 
string.sub(name_of_sel_track016) ..
        
'...'..string.sub(name_of_sel_trackstring_track_length-4string_track_length)
      elseif 
string_track_length == 0 then
        name_of_sel_track 
"Track untitled "..i+
      end
      
if 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 retvalretvals_csv reaper.GetUserInputs('Show tracks names'count_sel_tracksinputs_names'')
  
    if 
retval then
      
return
    else return 
end 

Last edited by Yanick; 10-27-2020 at 12:17 PM.
Yanick is offline   Reply With Quote
Old 10-27-2020, 11:30 AM   #3
jkooks
Human being with feelings
 
Join Date: May 2020
Posts: 190
Default

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
jkooks is offline   Reply With Quote
Old 10-27-2020, 11:39 AM   #4
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Well, or so If you just show
Yanick is offline   Reply With Quote
Old 10-27-2020, 11:40 AM   #5
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

That's brilliant. Thankyou both
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode 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 07:15 PM.


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