forked from ReaTeam/ReaScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release "Rename selected tracks from clipboard lines" v1.0
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Tracks Properties/cfillion_Rename selected tracks from clipboard lines.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- @description Rename selected tracks from clipboard lines | ||
-- @version 1.0 | ||
-- @author cfillion | ||
-- @website | ||
-- cfillion.ca https://cfillion.ca | ||
-- Request Post https://forum.cockos.com/showpost.php?p=2029104 | ||
-- @donate https://www.paypal.com/cgi-bin/webscr?business=T3DEWBQJAV7WL&cmd=_donations¤cy_code=CAD&item_name=ReaScript%3A+Rename+selected+tracks+from+clipboard+lines | ||
|
||
local script_name = ({reaper.get_action_context()})[2]:match("([^/\\_]+)%.lua$") | ||
local UNDO_STATE_TRACKCFG = 1 | ||
local clipboard, index = reaper.CF_GetClipboard(''), 0 | ||
|
||
if clipboard:len() < 1 or reaper.CountSelectedTracks(0) < 1 then | ||
reaper.defer(function() end) -- no undo point | ||
end | ||
|
||
reaper.Undo_BeginBlock() | ||
|
||
for line in clipboard:gmatch("([^\r\n]*)[\r\n]*") do | ||
local track = reaper.GetSelectedTrack(0, index) | ||
if not track then break end | ||
|
||
reaper.GetSetMediaTrackInfo_String(track, 'P_NAME', line, true) | ||
index = index + 1 | ||
end | ||
|
||
reaper.Undo_EndBlock(script_name, UNDO_STATE_TRACKCFG) |