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.
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
Tracks Properties/Lokasenna_Select tracks in selection with items.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,60 @@ | ||
--[[ | ||
Description: Select tracks in selection with items | ||
Version: 1.00 | ||
Author: Lokasenna | ||
Donation: https://paypal.me/Lokasenna | ||
Changelog: | ||
Initial release | ||
Links: | ||
Lokasenna's Website http://forum.cockos.com/member.php?u=10417 | ||
About: | ||
Extends the behavior of "Xenakios/SWS: Select tracks with no items" | ||
to only look within the currently selected tracks | ||
--]] | ||
|
||
-- Licensed under the GNU GPL v3 | ||
|
||
|
||
|
||
local function Main() | ||
|
||
local new_sel = {} | ||
|
||
-- Get number of selected tracks | ||
local num_sel = reaper.CountSelectedTracks(0) | ||
|
||
if num_sel == 0 then return end | ||
|
||
reaper.PreventUIRefresh(1) | ||
|
||
-- For each selected track | ||
for i = 1, num_sel do | ||
|
||
local track = reaper.GetSelectedTrack(0, i - 1) | ||
|
||
-- If it's not empty.. | ||
if reaper.CountTrackMediaItems(track) > 0 then | ||
|
||
-- Add to new_sel | ||
new_sel[#new_sel + 1] = track | ||
|
||
end | ||
|
||
end | ||
|
||
-- Deselect all tracks | ||
reaper.Main_OnCommand(40297, 0) | ||
|
||
-- Select tracks in new_sel | ||
for k, tr in pairs(new_sel) do | ||
|
||
reaper.SetTrackSelected(tr, true) | ||
|
||
end | ||
|
||
reaper.PreventUIRefresh(-1) | ||
reaper.UpdateArrange() | ||
|
||
end | ||
|
||
Main() |