|
|
|
04-07-2017, 03:56 PM
|
#1
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
ReaNamer (track-item-region renaming utility) [amagalma & gianfini]
[/i] The v1 and v2 scripts were removed from ReaPack and are now replaced by:
amagalma_gianfini_ReaNamer (track-item-region renaming utility)
(which is in essence: "amagalma_gianfini_Track-Item Name Manipulation - UNDO" v3)
- Manipulate track/item/region names (prefix/suffix, trim start/end, keep, clear, uppercase/lowercase, swap case/capitalize/titlecase, replace, strip leading & trailing whitespaces).
- Mode (tracks or items) is automatically chosen when the script starts. Then to change mode click on appropriate button.
- When satisfied with the modifications (which can be previewed in the list), COMMIT button writes the values to tracks/items/regions and creates an Undo point in Reaper's Undo History
- Requires SWS Extension
Key Shortcuts:
- Ctrl+T for Tracks mode
- Ctrl+R for Regions mode
- Ctrl+I for Items mode
- Ctrl+Enter Commit
- Ctrl+Z for Undo
- Ctrl+Shift+Z for Redo
- Alt+A for swAp case
- Alt+C for Clear
- Alt+E for trim End
- Alt+K for Keep
- Alt+L for Lowercase
- Alt+N for Number
- Alt+P for Prefix
- Alt+R for Replace
- Alt+S for trim Start
- Alt+T for Titlecase
- Alt+U for Uppercase
- Alt+W for strip Whitespaces
- Alt+X for suffiX
- Alt+Z for capitaliZe
Hello!
A new little script, inspired by spk77's python script: Manipulate track names
For the creation of the buttons and the mouse handling I have used spk77's code and I have used a Lokasenna function too. So, big thanks to both of them!
The script is here:
Track name manipulation
I would like some help from more experienced users: at the moment the script does not create any undo points. I would like undo points to be created under these two circumstances:
a) when the user exits the program
b) if the user changes track selection
How could this be accomplished?
EDIT: See post #4 for the final version
You may now find amagalma_Track Name Manipulation and amagalma_Item Name Manipulation in ReaPack.
Both scripts got replaced by the script amagalma_Track-Item Name Manipulation
Last edited by amagalma; 11-05-2020 at 11:16 AM.
|
|
|
04-07-2017, 05:45 PM
|
#2
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I haven't tried it, but you could do:
1) reaper.Undo_BeginBlock() when the script starts.
2) A function to see if the track selection has changed*, and then the following in Main():
Code:
if did_tracks_change then
reaper.Undo_EndBlock("Track name manipulator", 0)
reaper.Undo_BeginBlock()
end
3) reaper.Undo_EndBlock() as an else section for when gfx.getchar comes back as -1.
----------
* I had to do this in my "track selection follows item selection" script. Here's (I think) all you need:
Code:
local num_tracks
local sel_tracks = {}
-- *Very* limited for error checking, types, etc
-- Only use it if you know your tables will work
local function compare_tables(t1, t2)
if #t1 ~= #t2 then return false end
for k, v in pairs(t1) do
if v ~= t2[k] then return false end
end
return true
end
-- In Main()
-- Get the number of selected tracks
num_tracks = reaper.CountSelectedTracks( 0 )
-- Grab their MediaTracks into a table
local cur_tracks = {}
for i = 1, num_tracks do
cur_tracks[i] = reaper.GetSelectedTrack( 0, i - 1)
end
-- See if the current and stored track selections match
if not compare_tables(sel_tracks, cur_tracks) then
-- User changed the track selection
sel_tracks = cur_tracks
reaper.Undo_EndBlock("Track name manipulator", 0)
reaper.Undo_BeginBlock()
end
Checking all of the tracks on every loop might be pretty rough for the script's CPU usage, so you may want to use a timing function to only run that block every 500ms or something.
|
|
|
04-08-2017, 02:51 AM
|
#3
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Thank you Lokasenna for your help!
3) reaper.Undo_OnStateChangeEx("Track name manipulation", 1, -1) without a reaper.Undo_BeginBlock() seems to do the trick better. Making-an-Undo-point-when-exiting "problem" solved!
I am going to try what you suggest for the track selection change undo creation point "problem".
Edit: Hmm.. I can't get it to work properly.. I get "reascript: Run" in the Undo list instead of named Undos...
Edit2: I am getting there.. I had to avoid UndoBegin... I'll update in a bit the code..
Last edited by amagalma; 04-08-2017 at 06:59 AM.
|
|
|
04-08-2017, 05:58 AM
|
#4
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Manipulate track names (prefix, suffix, trim start, trim end, uppercase, lowercase, swap case, capitalize, titlecase, replace, strip leading & trailing whitespaces).
Undo points are created only if track names have been changed when you close the script or if track names have been changed when you change track selection.
Track Names Manipulation
available in ReaPack
|
|
|
04-13-2017, 12:53 AM
|
#5
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Great Job! That was strongly needed.
To make it really good there are few missing points I suggest
Basic version
- UNDO is key here, a small error and you get lots of tracks modified, and cannot get back to clean version
- There should be an option to add progressive numbering (in the beginning or at the end after suffix). It should have the number of digit option, start number, whether using numbers or letters
Advanced version (name building mode)
- possibility to build the naming from scratch, adding prefix, suffix, fixed text, progressive numbering and possibility to use old name as wildcard, building a mockup and committing all changes at once at the end. Preview of first 3-5 tracks should be available to see what you get.
For example Prefix=Snare, Suffix =" - mic ", Progressive numbering two digits, $track at the end: could result in "Snare - mic 01 AKG" "Snare - mic 02 SM57" "Snare - mic 03 SM58" (where AKG, SM57, SM58 were the original track names).
- possibility to add other wildcard in the building mode such as $item_name (first item), $channel_number, etc.
g
|
|
|
04-13-2017, 05:07 AM
|
#6
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Thanks!
Undo is already implemented. If you make a mistake just close the script and undo the last action!
I'll add at some point the progressive numbering. done!
For the rest, although they are very cool ideas, I do not have the time/knowledge to implement...
Edit: I added the progressive numbering ability. The update should be available later in ReaPack
Last edited by amagalma; 04-13-2017 at 07:34 AM.
|
|
|
04-13-2017, 12:15 PM
|
#7
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Quote:
Originally Posted by amagalma
Thanks!
Undo is already implemented. If you make a mistake just close the script and undo the last action!
I'll add at some point the progressive numbering. done!
For the rest, although they are very cool ideas, I do not have the time/knowledge to implement...
Edit: I added the progressive numbering ability. The update should be available later in ReaPack
|
thanks!
|
|
|
07-11-2017, 05:46 PM
|
#8
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
In ReaPack you may now find amagalma_Item Name Manipulation, the sister script that deals with item names.
|
|
|
07-15-2017, 07:54 AM
|
#9
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Both scripts got replaced by the script amagalma_Track-Item Name Manipulation
|
|
|
07-18-2017, 07:07 AM
|
#10
|
Human being with feelings
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
|
handy thanks much!
|
|
|
07-28-2017, 02:36 PM
|
#11
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
You're welcome
|
|
|
07-28-2017, 02:37 PM
|
#12
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Update: v1.1 (2017-07-28)
- Fixed crash when dealing with empty items
- Changed color scheme
- Added Clear button (clears all names)
- Added Keep button (trims names and keeps only the number of characters defined)
|
|
|
10-06-2017, 08:48 AM
|
#13
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Just a "first usage" report.
Got a project for mixing where all tracks are named "Songtitle - ..." which I find redundant seeing on the tracknames (when importing and Reaper autonames the tracks according to the filenames) and the items.
Fired up your script, "Replace" "Songtitle -" with nothing, bam, gone.
Until now I used Batch rename utility for such tasks but being able to do it directly in Reaper is nice.
Very useful script, thank you.
|
|
|
10-06-2017, 09:49 AM
|
#14
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
You are welcome!
Check v2 co-authored by Gianfini and me, it has some extra functionality and looks a lot better!
|
|
|
10-28-2020, 01:49 AM
|
#15
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
This script was removed from ReaPack and is now replaced by:
amagalma_gianfini_ReaNamer (track-item-region renaming utility)
changelog:
Replaces "amagalma_gianfini_Track-Item Name Manipulation - UNDO"
- add: Region name support
- fix: crash when clicking on empty list
- fix: Down button could be pressed past last list item
- fix: changes in number of list items are correctly shown (no more 'nil' names)
- change: moved help text to the bottom
- change: improved how list items show
|
|
|
10-28-2020, 02:25 AM
|
#16
|
Human being with feelings
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
|
Thank you, Amagalma, this look like a vvery handy script!
Do you think it would be possible to have such features as :
- REGIONS : something a bit like Reanoir : "change all the regions in time selection using random colors", "change all the regions in the time selection using shades from the selected color";
- REGIONS : rename region using track name (when a region is selected, as well as a track, obviously);
|
|
|
10-28-2020, 02:53 AM
|
#17
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by sinkmusic
Thank you, Amagalma, this look like a vvery handy script!
Do you think it would be possible to have such features as :
- REGIONS : something a bit like Reanoir : "change all the regions in time selection using random colors", "change all the regions in the time selection using shades from the selected color";
- REGIONS : rename region using track name (when a region is selected, as well as a track, obviously);
|
The first FR would be a FR for ReaNoir, which may happen sometime in the future. This utility deals with names, not colors.
The second FR, I don't see how this would work, nor I can see its usefulness.. Sorry!
|
|
|
10-28-2020, 03:33 AM
|
#18
|
Human being with feelings
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
|
Quote:
Originally Posted by amagalma
The first FR would be a FR for ReaNoir, which may happen sometime in the future. This utility deals with names, not colors.
|
Yes, Reannoir is amazing, i use it often
Should I duplicate the FR in the dedicated thread?
Quote:
Originally Posted by amagalma
The second FR, I don't see how this would work, nor I can see its usefulness.. Sorry!
|
It can be useful depending on your process.
For instance, when you record, you can give the recording the track name (so your audio file have the track name, and can't have the region name).
But later in the production stage, if you need to share stems, you may need to have your stems rendered according to the project region (as tracks can be in a folder, or for whatever reason), so it could be useful to get the original track name and have it written in the region (if that makes sense).
|
|
|
10-28-2020, 02:22 PM
|
#19
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by sinkmusic
Yes, Reannoir is amazing, i use it often
Should I duplicate the FR in the dedicated thread?
|
No need to.. it has been requested a few times and it has been on my plans for a long time
Quote:
It can be useful depending on your process.
For instance, when you record, you can give the recording the track name (so your audio file have the track name, and can't have the region name).
But later in the production stage, if you need to share stems, you may need to have your stems rendered according to the project region (as tracks can be in a folder, or for whatever reason), so it could be useful to get the original track name and have it written in the region (if that makes sense).
|
You can create regions from items ("Markers: Insert separate regions for each selected item") .. I still don't get it...
|
|
|
10-28-2020, 04:33 PM
|
#20
|
Human being with feelings
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
|
Quote:
Originally Posted by amagalma
No need to.. it has been requested a few times and it has been on my plans for a long time
|
Thanks!
Quote:
Originally Posted by amagalma
You can create regions from items ("Markers: Insert separate regions for each selected item") .. I still don't get it...
|
Argh, sorry if i was unclear. It's a workflow thing, quite hard to explain... It depends on the way you record, the way you manage your items,the amount of samples you have and how you need to have your items in the end.
For instance : i record an item. It's a 10 minutes session with 200 short sounds on it. The item name is inherited from the instrument I recorded (for instance "Moog").
I put this item on a new track, which will have for name the kind of sound i recorded (for instance "bass").
Now i slice my session into hundreds of singles samples or snippets, depending on the timbre or note of the sounds (for instance "high resonance", "sub enabled", "square+saw", "C, D, E", etc).
My goal now would be to export each slices using the Region render matrix with such a string : "trackname_itemname_regionname01.wav".
I wish I could easily convert the markers into regions (because When I record, it's easy to drop markers on the fly during the recording, not regions).
I also wish I could give a region the name from a track (because sometimes you just change your mind, or also because sometimes when working with several group/sub folders, you realize it would be easier to have a region with a good name instead of too many sub-folders. In such a situation, I wish I could grab and item, and the script would get the name (where the item is) and give the track name to the region (where the item is, obvisouly).
I don't know if it sounds confuse or if that makes sense
|
|
|
10-29-2020, 01:26 AM
|
#21
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
This is not a job that would be suited to this utility.
However, I have uploaded to ReaPack two actions for you:
amagalma_Rename region at edit cursor after the first selected item
amagalma_Rename region at edit cursor after the first selected track
|
|
|
10-29-2020, 06:57 AM
|
#22
|
Human being with feelings
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
|
Quote:
Originally Posted by amagalma
This is not a job that would be suited to this utility.
However, I have uploaded to ReaPack two actions for you:
amagalma_Rename region at edit cursor after the first selected item
amagalma_Rename region at edit cursor after the first selected track
|
Wonderful, thank you so much!
|
|
|
10-29-2020, 07:11 AM
|
#23
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Hi, now i'm getting (track-item-region renaming utility).lua:1445: attempt to perform bitwise operation on a string value (field '?')
at each Commit
Only when in TRACK mode
g
|
|
|
10-29-2020, 09:56 AM
|
#24
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by Gianfini
Hi, now i'm getting (track-item-region renaming utility).lua:1445: attempt to perform bitwise operation on a string value (field '?')
at each Commit
Only when in TRACK mode
g
|
In my system, Lua automatically casts the string to number, so the bitwise operation works.. Maybe it doesn't work in all systems? No idea! Anyway, I added a tonumber(), in order to force manually the casting, so it will work always.. Uploading v1.02..
|
|
|
10-29-2020, 10:09 AM
|
#25
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Quote:
Originally Posted by amagalma
In my system, Lua automatically casts the string to number, so the bitwise operation works.. Maybe it doesn't work in all systems? No idea! Anyway, I added a tonumber(), in order to force manually the casting, so it will work always.. Uploading v1.02..
|
thanks I'll test it anyway on my Mac at home tonight and let you know
g
|
|
|
10-30-2020, 02:52 AM
|
#26
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
still
1446: attempt to perform bitwise operation on a nil value
Only in TRACK MODE
I'm currently testing on a PORTABLE INSTALL. Could that be the problem? will switch soon to fixed install and test it again
g
|
|
|
10-30-2020, 03:24 AM
|
#27
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by Gianfini
still
1446: attempt to perform bitwise operation on a nil value
Only in TRACK MODE
I'm currently testing on a PORTABLE INSTALL. Could that be the problem? will switch soon to fixed install and test it again
g
|
Hmm.. then it seems like BR_Win32_GetPrivateProfileString is not working correctly or for some reason the keys are named differently on your system!?.. What platform are you on? Mac?
Please, try this script and tell me what you see:
Code:
flag = ({reaper.BR_Win32_GetPrivateProfileString( "trackmgr", "flags", "", reaper.get_ini_file() )})[2]
_, flag2 = reaper.BR_Win32_GetPrivateProfileString( "trackmgr", "flags", "", reaper.get_ini_file() )
reaper.ShowConsoleMsg(string.format("flag1: %s flag2: %s\n", flag, flag2))
|
|
|
10-30-2020, 03:27 AM
|
#28
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Furthermore, run action "Show REAPER resource path in explorer" and then open your reaper.ini and do a search for "[trackmgr]". Post all things under it until the next []. Thanks!
|
|
|
10-30-2020, 03:46 AM
|
#29
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Quote:
Originally Posted by amagalma
Furthermore, run action "Show REAPER resource path in explorer" and then open your reaper.ini and do a search for "[trackmgr]". Post all things under it until the next []. Thanks!
|
Here it is
[trackmgr]
wnd_vis=0
wnd_left=726
wnd_top=336
wnd_width=468
wnd_height=367
remember: it's a portable install
|
|
|
10-30-2020, 04:41 AM
|
#30
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Quote:
Originally Posted by amagalma
Hmm.. then it seems like BR_Win32_GetPrivateProfileString is not working correctly or for some reason the keys are named differently on your system!?.. What platform are you on? Mac?
Please, try this script and tell me what you see:
Code:
flag = ({reaper.BR_Win32_GetPrivateProfileString( "trackmgr", "flags", "", reaper.get_ini_file() )})[2]
_, flag2 = reaper.BR_Win32_GetPrivateProfileString( "trackmgr", "flags", "", reaper.get_ini_file() )
reaper.ShowConsoleMsg(string.format("flag1: %s flag2: %s\n", flag, flag2))
|
Here is what comes out with your script (see attachment)
|
|
|
10-30-2020, 04:56 AM
|
#31
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Ok, just checked with a portable install. The [trackmgr] entry is created once you open the Track Manager and the flags entry is created once you change options.
v1.03 changelog
- fix: crash when commiting changes in Track mode for portable installs
- add: show pop-up if SWS is not installed
Should be ok now
|
|
|
10-30-2020, 06:49 AM
|
#32
|
Human being with feelings
Join Date: Jan 2015
Posts: 795
|
Quote:
Originally Posted by amagalma
Ok, just checked with a portable install. The [trackmgr] entry is created once you open the Track Manager and the flags entry is created once you change options.
v1.03 changelog
- fix: crash when commiting changes in Track mode for portable installs
- add: show pop-up if SWS is not installed
Should be ok now
|
Works now!
that was not easy!
thanks
|
|
|
10-30-2020, 10:09 AM
|
#33
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Guys, i get this error when synchronizing packages in ReaPack:
ReaTeam Scripts/Various/ReaNamer (track-item-region renaming utility) v1.03:
Conflict: Scripts/ReaTeam Scripts/Various/amagalma_Track-Item Name Manipulation Replace Help.lua is already owned by another package
Any clue ?
OSX 10.15.7, Latest Reaper dev release.
|
|
|
10-30-2020, 03:21 PM
|
#34
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,128
|
Quote:
Originally Posted by vanhaze
Guys, i get this error when synchronizing packages in ReaPack:
ReaTeam Scripts/Various/ReaNamer (track-item-region renaming utility) v1.03:
Conflict: Scripts/ReaTeam Scripts/Various/amagalma_Track-Item Name Manipulation Replace Help.lua is already owned by another package
Any clue ?
OSX 10.15.7, Latest Reaper dev release.
|
yup me too
On mac as well
|
|
|
10-31-2020, 07:42 AM
|
#35
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
v1.08 changelog:
- add: ability to specify separator when numbering
- add: ability to match case or not in pattern replacement
- change: in Replace mode from now on there is no need to escape commas
- change: name of provided help file for the Replace
- change: updated help file for the Replace
|
|
|
10-31-2020, 07:44 AM
|
#36
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by amagalma
- change: name of provided help file for the Replace
|
@vanhaze & @lexaproductions: I think now it should be ok
|
|
|
10-31-2020, 10:33 AM
|
#37
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,128
|
Great thanks.
Could you consider linking Ctl-Enter to commit/close? To be able to close the script without the mouse?
|
|
|
10-31-2020, 10:37 AM
|
#38
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Quote:
Originally Posted by amagalma
@vanhaze & @lexaproductions: I think now it should be ok
|
Yes, it is, thx a bunch !!
|
|
|
11-01-2020, 08:15 AM
|
#39
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
v1.10 changelog:
- add: focus is returned back to script after a GetUserInputs dialog
- add: Ctrl+Enter to Commit
- add: T key for Tracks mode, R key for Regions mode, I key for Items mode
If anyone has any other ideas regarding key shortcuts, I listen
|
|
|
11-01-2020, 09:25 AM
|
#40
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,128
|
Oh wow thanks!
I wouldn’t mind being able to choose each renaming modes with Alt-[LETTER]
Alt-R for replace
Alt-A for Append
Etc...
|
|
|
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 04:27 AM.
|