View Single Post
Old 09-20-2019, 08:35 AM   #8
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,077
Default

Quote:
Originally Posted by Edgemeal View Post
paypal.me/Edgemeal

Sorry, I don't understand what you want the text name to be, so unchanged for now, added master track..

Code:
-- Get Project Data (v0.02)
-- Edgemeal - Sept, 20, 2019

function get_line(filename, line_number)
  local i = 0
  for line in io.lines(filename) do
    i = i + 1
    if i == line_number then
      return line
    end
  end
  return nil -- line not found
end

function GetLastWord(line)
  local lastpos = (line:reverse()):find(' ')
  return (line:sub(-lastpos+1))
end

function AddFX(track,fx_count)
  for fx = 0, fx_count-1 do
    local _, fx_name = reaper.TrackFX_GetFXName(track, fx, "")
    local _, presetname = reaper.TrackFX_GetPreset(track, fx, "") 
    if presetname ~= "" then  -- add track fx name and preset name
      t[#t+1]= fx_name .. " Preset: "..presetname 
    else
      t[#t+1]= fx_name 
    end
  end
end

function Main() 
  local proj, projfn = reaper.EnumProjects(-1, "") 
  if projfn ~= "" then
    t[#t+1]="Project: "..reaper.GetProjectName(proj, "")
    t[#t+1]="Path: "..reaper.GetProjectPath("") 
    local line = get_line(projfn, 1)-- project time stamp, Unix format, last word in 1st line of project file.
    local unixTS = (GetLastWord(line))
    t[#t+1]='Date: ' ..(os.date("%B %d, %Y  %X", tonumber(unixTS))) -- convert to "month day, year  time"
  else
    t[#t+1]="Unknown project (not saved)" 
  end
  t[#t+1]= ""  -- empty line
  
  -- Master Track
  local track = reaper.GetMasterTrack(0)
  local fx_count = reaper.TrackFX_GetCount(track)
  if fx_count > 0 then
    t[#t+1]="Master Track"
    AddFX(track,fx_count)
    t[#t+1]= ""  -- empty line 
  end
  
  -- Regular Tracks 
  local track_count = reaper.CountTracks(0)
  for i = 0, track_count-1  do
    local track = reaper.GetTrack(0, i)
    local _, track_name = reaper.GetTrackName(track)
    t[#t+1]='Track '..tostring(i+1)..': '..track_name  -- add track name to table 
    local fx_count = reaper.TrackFX_GetCount(track)
    AddFX(track,fx_count) 
    t[#t+1]= ""  -- empty line
  end 
  
  -- save project data to text file in project folder 
  if projfn ~= "" then
    file = io.open(projfn..".txt", "w")
    file:write(table.concat(t,"\n")) 
    file:close()
  else
    reaper.ShowConsoleMsg(table.concat(t,"\n"))
  end
end

t = {} -- store proj data
Main()
Can the text file name included the string "Project Plugins" as well as what you have now?
ie
"My Techno Jam - Project Plugins.txt"
or something like that
just add the phrase project plugins to the text's file name.

Project Name + "Project Plugins" . txt

Just take what you already have and add a string to the file's name

myreaperproject - project plugins.rpp.txt
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote