Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER General Discussion Forum

Reply
 
Thread Tools Display Modes
Old 09-19-2019, 11:59 AM   #1
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default Is it possible to save out FX for Reaper please help?

Hi. I would like to save a plain text file with the following information in it, by default, in the project folder.

Name of Reaper project
Date of save last change
FX used in project
Preset names if applicable - not essential but I prefer.

How can I export this without going crazy? I can't solve this.


(not quite what I ask, mpl_Save selected tracks FX chains please?)

proof of concept.txt
=====================

Project Name #1
2019-09-19

Track 1:
Serum
ReaVerb

Track 2:
Massive

Track 3:
ReaSynth (preset: CoolSynth)

etc.
__________________
47.8% of statistics are made up.

Last edited by lowellben; 09-19-2019 at 12:04 PM.
lowellben is offline   Reply With Quote
Old 09-19-2019, 12:36 PM   #2
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Is there a way to like grep out something from the mpl script is that easier?
Like from the FX chain saved files from mpl, extract the lines like
mpl_Save selected tracks FX chains

FILENAME
VST "VSTi: Massive (Native Ins)"
PRESETNAME NewSoundDefault

Is that easier to do please?
I feel like the data is there I just cannot learn how to put it into a text file by itself.
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-20-2019, 01:27 AM   #3
Flavio
Human being with feelings
 
Flavio's Avatar
 
Join Date: Mar 2013
Location: Italy - Monza
Posts: 139
Default

Nice topic. Joining the thread.
Flavio is offline   Reply With Quote
Old 09-20-2019, 05:02 AM   #4
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Hello there. I was hoping the MPL script may be modified to simply output a text file of the list of FX and presets in project folder. Not sure if LUA is able to handle this but I sure hope
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-20-2019, 06:34 AM   #5
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

How about something like this, It should create a .Txt file in project folder, (testing on Win10),
EDIT: Forgot about the Master Track, will try and update it later today if you find this useful.

CODE > See post #13

Last edited by Edgemeal; 09-20-2019 at 02:19 PM.
Edgemeal is offline   Reply With Quote
Old 09-20-2019, 06:51 AM   #6
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by Edgemeal View Post
How about something like this, It should create a .Txt file in project folder, (testing on Win10),
EDIT: Forgot about the Master Track, will try and update it later today if you find this useful.
Code:
-- Get Project Data
-- 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 Main()
  local t = {}
  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
  
  local track_count = reaper.CountTracks(0)
  for i = 0, track_count-1  do
    local track = reaper.GetTrack(0, i)
    local retval, 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)
    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
    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

Main()
This is brilliant and exactly what I was hoping it could be. Wow. If you can add the master, that would be heavenly. However, is it possible to change the output txt file name to something other than the literal project.rpp.txt name? Just like %projectname% - Project FX and Presets.txt or something.

Also do you have a paypal donate script link?
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-20-2019, 07:49 AM   #7
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

Quote:
Originally Posted by lowellben View Post
This is brilliant and exactly what I was hoping it could be. Wow. If you can add the master, that would be heavenly. However, is it possible to change the output txt file name to something other than the literal project.rpp.txt name? Just like %projectname% - Project FX and Presets.txt or something.

Also do you have a paypal donate script link?
paypal.me/Edgemeal

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

Last edited by Edgemeal; 09-20-2019 at 10:16 AM.
Edgemeal is offline   Reply With Quote
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,058
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
Old 09-20-2019, 08:53 AM   #9
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

How about the format, 'ProjectName.RPP - Project Plugins.txt'
or , 'ProjectName - Project Plugins.txt'
?

BTW, you don't need to quote the code in every reply.
Edgemeal is offline   Reply With Quote
Old 09-20-2019, 09:05 AM   #10
RJHollins
Human being with feelings
 
Join Date: Dec 2011
Posts: 1,373
Default

this looks interesting ...

question: how do we go about using/running this script ??

thx
RJHollins is offline   Reply With Quote
Old 09-20-2019, 09:16 AM   #11
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by Edgemeal View Post
How about the format, 'ProjectName.RPP - Project Plugins.txt'
or , 'ProjectName - Project Plugins.txt'
?

BTW, you don't need to quote the code in every reply.
Sorry I'm slow but not by design.

'ProjectName - Project Plugins.txt' would be great!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-20-2019, 09:42 AM   #12
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Bloody hell this is perfect!! I am incapable of thanking you enough. Workflow masterpiece. Will you reapack this? You should. You scripters are just amazing.

It's perfect in my eyes!*


* one question, how difficult would it be to have a new line of ---- below each track name just for visual clarity?

Track 1: Piano
-----------------

Track 2: Synth
-----------------
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-20-2019, 10:15 AM   #13
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

Quote:
Originally Posted by lowellben View Post
* one question, how difficult would it be to have a new line of ---- below each track name just for visual clarity?
OK, try..
Code:
-- Get Project Data (v0.04)
-- Edgemeal - Sept, 20, 2019
-- Donate: paypal.me/Edgemeal

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

local function RemoveFileExt(file)
  local index = (file:reverse()):find("%.")
  if index > 0 then
    return string.sub(file, 1, #file-index)
  else
    return file
  end  
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 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 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
    local tn ="Master Track\n"  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1) 
    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)
    local tn ='Track '..tostring(i+1)..': '..track_name..'\n'  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1)
    AddFX(track,reaper.TrackFX_GetCount(track)) 
    t[#t+1]= ""  -- empty line
  end 
  
  -- save project data to text file in project folder 
  if projfn ~= "" then
    file = io.open(RemoveFileExt(projfn).." - Project Plugins.txt", "w")
    file:write(table.concat(t,"\n")) 
    file:close()
  else
    reaper.ShowConsoleMsg(table.concat(t,"\n"))
  end
end

t = {} -- store proj data
Main()
Edgemeal is offline   Reply With Quote
Old 09-20-2019, 12:57 PM   #14
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Damn. You got the ---- to be the length of the track names? AH you are amazing. Thank you so much for this. I know many of us will use it. MANY. Perfecto!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-20-2019, 08:00 PM   #15
RJHollins
Human being with feelings
 
Join Date: Dec 2011
Posts: 1,373
Default

How to we run this ???
RJHollins is offline   Reply With Quote
Old 09-21-2019, 04:14 AM   #16
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Go to actions, and load it as a ReaScript and you will be good to go. It will appear in actions list then. It's awesome.
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 09:56 AM   #17
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,081
Default

wonder if Edgemeal can add the ability for the lua to print or save as the text to a text file?

sure we can copy and paste, but what if???
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 09-21-2019, 11:02 AM   #18
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by hopi View Post
wonder if Edgemeal can add the ability for the lua to print or save as the text to a text file?

sure we can copy and paste, but what if???
? It saves a text file in the project folder? What do you mean?
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 11:33 AM   #19
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,081
Default

oh? I did not know that... I guess that is fine then

EDIT: something seems amiss... when I run it on a new project it works OK
but then just tried on a collaboration project ... that project loads with a few plugins missing since the
creator has a few that I don't have.. and the lua when run does not put up a window and nothing gets saved to the project folder

am I doing something wrong???

I think what I mean earlier is that it could write the info to the Project Notes ... that would make sense to me, no?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain

Last edited by hopi; 09-21-2019 at 11:46 AM.
hopi is offline   Reply With Quote
Old 09-21-2019, 12:21 PM   #20
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 5,452
Default

I added to Edgemeal's code above the following to have disabled FX marked as such

Code:
    local enabled =  reaper.TrackFX_GetEnabled(track, fx)
    if presetname ~= "" then  -- add track fx name and preset name
      t[#t+1] = (enabled and "" or "* ") .. fx_name .. " Preset: " .. presetname
    else
      t[#t+1] = (enabled and "" or "* ") .. fx_name
    end
This writes an asterisk before a disabled FX.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 09-21-2019, 03:00 PM   #21
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by Fabian View Post
I added to Edgemeal's code above the following to have disabled FX marked as such

Code:
    local enabled =  reaper.TrackFX_GetEnabled(track, fx)
    if presetname ~= "" then  -- add track fx name and preset name
      t[#t+1] = (enabled and "" or "* ") .. fx_name .. " Preset: " .. presetname
    else
      t[#t+1] = (enabled and "" or "* ") .. fx_name
    end
This writes an asterisk before a disabled FX.
Nice!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 03:01 PM   #22
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by hopi View Post
oh? I did not know that... I guess that is fine then

EDIT: something seems amiss... when I run it on a new project it works OK
but then just tried on a collaboration project ... that project loads with a few plugins missing since the
creator has a few that I don't have.. and the lua when run does not put up a window and nothing gets saved to the project folder

am I doing something wrong???

I think what I mean earlier is that it could write the info to the Project Notes ... that would make sense to me, no?
I've tried it so far working on all projects new and 5 years old. But I agree I would LOVE for the project notes to have that written to. What a lifesaver! But the text file in the project folder is very handy too for archival so I can't complain
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 04:11 PM   #23
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,081
Default

lowellbean... could you plz post the full code again that includes fabians addition?

I must have screwed something up... thanks
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 09-21-2019, 05:17 PM   #24
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by hopi View Post
lowellbean... could you plz post the full code again that includes fabians addition?

I must have screwed something up... thanks
Hey Hopi,

I just added the extra code to the project txt file lua and works here, just copy this to a new LUA file

https://pastebin.com/raw/TwSnx04P

Lemme know you got it.
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 05:19 PM   #25
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by Edgemeal View Post
This saves the text to the project notes., I also added Fabian's code,..
Does it have to overwrite all project notes though? I think that's dangerous no? Is there an append function with new line maybe?
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 06:35 PM   #26
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,081
Default

thanks to you both Edge and Lowell...

I do have a thought or two...

It seems like if the project is not yet saved and I run the lua, it puts up it's own text window... makes sense cuz there is no project notes yet...

But IF the project has been saved, it runs but shows no indication that it has run... so a user [dumb one like me] could think nothing happened and try to run it again... hahahaha and doing that writes another copy to the the project notes each time

I guess what would be more ideal for dummies like me, would be for it ask, "write project note"... "overwrite project notes" or "append to project notes"....
...or minimally give some indication that it did run....

I hope I'm making some sense....
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 09-21-2019, 06:46 PM   #27
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by hopi View Post
thanks to you both Edge and Lowell...

I do have a thought or two...

It seems like if the project is not yet saved and I run the lua, it puts up it's own text window... makes sense cuz there is no project notes yet...

But IF the project has been saved, it runs but shows no indication that it has run... so a user [dumb one like me] could think nothing happened and try to run it again... hahahaha and doing that writes another copy to the the project notes each time

I guess what would be more ideal for dummies like me, would be for it ask, "write project note"... "overwrite project notes" or "append to project notes"....
...or minimally give some indication that it did run....

I hope I'm making some sense....
I like it being silent so I can continue editing the project without having to stop what I'm doing and grab my mouse and click a dialog box pop up but I see your point But I'm glad I got the ball rolling!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 06:49 PM   #28
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by Edgemeal View Post
Didn't think of that , fixed.
perfecto!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-21-2019, 06:57 PM   #29
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

Quote:
Originally Posted by lowellben View Post
perfecto!
No, the project notes will just keep growing with every save LOL! I might be able to get around that. Personally I like saving the info to a separate text file.
Edgemeal is offline   Reply With Quote
Old 09-21-2019, 08:09 PM   #30
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,081
Default

Edge... I'm with you I think... changed my mind about project notes as I can always copy and paste into that as wanted....

after finding it silently put 3 copies into the Project notes that I had to go delete... I think the separate file would be better...
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 09-22-2019, 04:47 AM   #31
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Quote:
Originally Posted by Edgemeal View Post
No, the project notes will just keep growing with every save LOL! I might be able to get around that. Personally I like saving the info to a separate text file.
oh haha right right. I guess if you keep running the script yes it will keep growing but yes I use the txt file personally. thanks!!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-22-2019, 09:49 AM   #32
Bribedant
Human being with feelings
 
Bribedant's Avatar
 
Join Date: Jan 2017
Location: Sweden
Posts: 45
Default

Quote:
Originally Posted by Edgemeal View Post
OK, try..
Code:
-- Get Project Data (v0.04)
-- Edgemeal - Sept, 20, 2019
-- Donate: paypal.me/Edgemeal

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

local function RemoveFileExt(file)
  local index = (file:reverse()):find("%.")
  if index > 0 then
    return string.sub(file, 1, #file-index)
  else
    return file
  end  
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 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 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
    local tn ="Master Track\n"  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1) 
    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)
    local tn ='Track '..tostring(i+1)..': '..track_name..'\n'  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1)
    AddFX(track,reaper.TrackFX_GetCount(track)) 
    t[#t+1]= ""  -- empty line
  end 
  
  -- save project data to text file in project folder 
  if projfn ~= "" then
    file = io.open(RemoveFileExt(projfn).." - Project Plugins.txt", "w")
    file:write(table.concat(t,"\n")) 
    file:close()
  else
    reaper.ShowConsoleMsg(table.concat(t,"\n"))
  end
end

t = {} -- store proj data
Main()
I too could have good use of this script. But when running in my Win7 x64 Reaper v5.962 (will update after some heavy project's are finished) I get this at line 70 "bad argument #2 to 'GetTrackName' (string expected, got no value)".
To old Reaper version maybe?
Bribedant is offline   Reply With Quote
Old 09-22-2019, 10:19 AM   #33
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

Quote:
Originally Posted by Bribedant View Post
I too could have good use of this script. But when running in my Win7 x64 Reaper v5.962 (will update after some heavy project's are finished) I get this at line 70 "bad argument #2 to 'GetTrackName' (string expected, got no value)".
To old Reaper version maybe?
Seems v5.962 doesn't like, reaper.GetTrackName(track) (which is what newest API docs show), so I changed it to reaper.GetTrackName(track,"") and it works, in old ver and new now,..


This version also can show the text file in Windows notepad after created, you'll need to uncomment the line of code near bottom.
Code:
-- Save project plugin info to text file (v0.06)
-- Edgemeal - Sept, 22, 2019
-- Donate: https://www.paypal.me/Edgemeal

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

local function RemoveFileExt(file)
  local index = (file:reverse()):find("%.")
  if index > 0 then
    return string.sub(file, 1, #file-index)
  else
    return file
  end  
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, "")
    local enabled = reaper.TrackFX_GetEnabled(track, fx) -- enabled
    if presetname ~= "" then  -- add track fx name and preset name
      t[#t+1] = (enabled and "" or "* ") .. fx_name .. " Preset: " .. presetname
    else
      t[#t+1] = (enabled and "" or "* ") .. fx_name
    end
  end
end

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 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]= '* = Plugin disabled.'
  t[#t+1]= ""  -- empty line
  
  -- Master Track
  local track = reaper.GetMasterTrack(0)
  local fx_count = reaper.TrackFX_GetCount(track)
  if fx_count > 0 then
    local tn ="Master Track\n"  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1) 
    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,"")
    local tn ='Track '..tostring(i+1)..': '..track_name..'\n'  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1)
    AddFX(track,reaper.TrackFX_GetCount(track)) 
    t[#t+1]= ""  -- empty line
  end 
  
  -- save project info to text file in project folder 
  if projfn ~= "" then
    local fn = RemoveFileExt(projfn).." - Project Plugins.txt"
    local file = io.open(fn, "w")
    file:write(table.concat(t,"\n")) 
    file:close()
    -- reaper.ExecProcess('notepad.exe '..fn,-1) -- open text file in notepad
  else
    reaper.ShowConsoleMsg(table.concat(t,"\n"))
  end
end

t = {} -- store proj data
Main()
API Documentation
v5.962,
Lua: boolean retval, string buf = reaper.GetTrackName(MediaTrack track, string buf)
v5.983,
Lua: boolean retval, string buf = reaper.GetTrackName(MediaTrack track)

Why the change ??

Last edited by Edgemeal; 09-22-2019 at 10:39 AM.
Edgemeal is offline   Reply With Quote
Old 09-22-2019, 10:57 AM   #34
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,081
Default

thanks much Edge... that works great...
nice little text file in the project folder... clean and neat
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 09-22-2019, 11:16 AM   #35
lowellben
Human being with feelings
 
lowellben's Avatar
 
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,058
Default

Bloody wonderful and perfect and awesome and thank you!!!!
__________________
47.8% of statistics are made up.
lowellben is offline   Reply With Quote
Old 09-23-2019, 08:12 AM   #36
Bribedant
Human being with feelings
 
Bribedant's Avatar
 
Join Date: Jan 2017
Location: Sweden
Posts: 45
Default

Quote:
Originally Posted by Edgemeal View Post
Seems v5.962 doesn't like, reaper.GetTrackName(track) (which is what newest API docs show), so I changed it to reaper.GetTrackName(track,"") and it works, in old ver and new now,..


This version also can show the text file in Windows notepad after created, you'll need to uncomment the line of code near bottom.
Code:
-- Save project plugin info to text file (v0.06)
-- Edgemeal - Sept, 22, 2019
-- Donate: https://www.paypal.me/Edgemeal

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

local function RemoveFileExt(file)
  local index = (file:reverse()):find("%.")
  if index > 0 then
    return string.sub(file, 1, #file-index)
  else
    return file
  end  
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, "")
    local enabled = reaper.TrackFX_GetEnabled(track, fx) -- enabled
    if presetname ~= "" then  -- add track fx name and preset name
      t[#t+1] = (enabled and "" or "* ") .. fx_name .. " Preset: " .. presetname
    else
      t[#t+1] = (enabled and "" or "* ") .. fx_name
    end
  end
end

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 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]= '* = Plugin disabled.'
  t[#t+1]= ""  -- empty line
  
  -- Master Track
  local track = reaper.GetMasterTrack(0)
  local fx_count = reaper.TrackFX_GetCount(track)
  if fx_count > 0 then
    local tn ="Master Track\n"  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1) 
    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,"")
    local tn ='Track '..tostring(i+1)..': '..track_name..'\n'  -- add track name 
    t[#t+1]=tn..string.rep('-', #tn-1)
    AddFX(track,reaper.TrackFX_GetCount(track)) 
    t[#t+1]= ""  -- empty line
  end 
  
  -- save project info to text file in project folder 
  if projfn ~= "" then
    local fn = RemoveFileExt(projfn).." - Project Plugins.txt"
    local file = io.open(fn, "w")
    file:write(table.concat(t,"\n")) 
    file:close()
    -- reaper.ExecProcess('notepad.exe '..fn,-1) -- open text file in notepad
  else
    reaper.ShowConsoleMsg(table.concat(t,"\n"))
  end
end

t = {} -- store proj data
Main()
API Documentation
v5.962,
Lua: boolean retval, string buf = reaper.GetTrackName(MediaTrack track, string buf)
v5.983,
Lua: boolean retval, string buf = reaper.GetTrackName(MediaTrack track)

Why the change ??
Hm, well I still get an error msg om my "old" Reaper but going to update soon so I guess I can wait
This script will be useful, thanks.
Bribedant is offline   Reply With Quote
Old 09-23-2019, 04:15 PM   #37
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

Quote:
Originally Posted by Bribedant View Post
Hm, well I still get an error msg om my "old" Reaper but going to update soon so I guess I can wait
This script will be useful, thanks.
IOW if other API functions changed or its something in your project we overlooked and is messing up the code. Can you zip and post a copy of the project file? We only need the .RPP file, remove any midi items from the copy also.
Edgemeal is offline   Reply With Quote
Old 09-23-2019, 05:49 PM   #38
Bribedant
Human being with feelings
 
Bribedant's Avatar
 
Join Date: Jan 2017
Location: Sweden
Posts: 45
Default

Quote:
Originally Posted by Edgemeal View Post
IOW if other API functions changed or its something in your project we overlooked and is messing up the code. Can you zip and post a copy of the project file? We only need the .RPP file, remove any midi items from the copy also.
Get error msg on every project. Tested on a complex project and a couple of freshly created containing only one or two sound files. I'll try and attache v0.04/0.06 err msg screen dumps.
Reaper v5.962. Can send a RPP also if you need.
Attached Images
File Type: jpg v0.04.jpg (46.9 KB, 6 views)
File Type: jpg v0.06.jpg (52.1 KB, 4 views)
Bribedant is offline   Reply With Quote
Old 09-23-2019, 06:32 PM   #39
Neutronic
Human being with feelings
 
Neutronic's Avatar
 
Join Date: Sep 2013
Posts: 382
Default

Quote:
Originally Posted by Edgemeal View Post
Seems v5.962 doesn't like, reaper.GetTrackName(track) (which is what newest API docs show), so I changed it to reaper.GetTrackName(track,"") and it works, in old ver and new now,..
You can alternatively get track names through GetSetMediaTrackInfo_String() using the P_NAME attribute.

Neutronic is offline   Reply With Quote
Old 09-23-2019, 07:21 PM   #40
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,384
Default

OK, v0.07, this one is using, reaper.GetSetMediaTrackInfo_String, though I'm not sure what stringNeedBig means, I'm just using "" as param. I did't try this on v5.962.

Code:
-- Save project plugin info to text file (v0.07)
-- Edgemeal - Sept, 22, 2019
-- Donate: https://www.paypal.me/Edgemeal

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

local function RemoveFileExt(file)
  local index = (file:reverse()):find("%.")
  if index > 0 then
    return string.sub(file, 1, #file-index)
  else
    return file
  end  
end

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

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 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" 
    t[#t+1]='Length: ' .. reaper.format_timestr(reaper.GetProjectLength(proj), "") 
  else
    t[#t+1]="Unknown project (not saved)"
  end
  t[#t+1]= '* = Plugin disabled.'
  t[#t+1]= ""  -- empty line
  
  -- Master Track
  local track = reaper.GetMasterTrack(0)
  local fx_count = reaper.TrackFX_GetCount(track)
  if fx_count > 0 then
    local tn ="Master Track\n"  -- add track name
    t[#t+1]=tn..string.rep('-', #tn-1)
    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.GetSetMediaTrackInfo_String(track, 'P_NAME' , '', false)
    
    -- local _, track_name = reaper.GetTrackName(track, "") -- NOTE: API docs from v5.983 only shows one param, v5.962 shows a 2nd param. 

    local tn ='Track '..tostring(i+1)..': '..track_name..'\n'  -- add track name
    t[#t+1]=tn..string.rep('-', #tn-1)
    AddFX(track,reaper.TrackFX_GetCount(track))
    t[#t+1]= ""  -- empty line
  end
  
  -- save project info to text file in project folder
  if projfn ~= "" then
    local fn = RemoveFileExt(projfn).." - Project Plugins.txt"
    local file = io.open(fn, "w")
    file:write(table.concat(t,"\n")) 
    file:close()
    reaper.ExecProcess('notepad.exe '..fn,-1) -- OPTIONAL: Open text file in Windows Notepad.
  else
    reaper.ShowConsoleMsg(table.concat(t,"\n"))
  end
end

t = {} -- store proj info
Main()
Edgemeal 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 12:15 PM.


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