generated from cfillion/reapack-repository-template
-
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.
Create smandrap_Select previous track in TCP or in Mixer.lua
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
Navigation/smandrap_Select previous track in TCP or in Mixer.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,26 @@ | ||
local mixer_hwnd = reaper.JS_Window_Find("Mixer", true) | ||
local focus = reaper.JS_Window_GetParent(reaper.JS_Window_GetFocus()) | ||
|
||
local function prev_in_mcp() | ||
local first_sel_t = reaper.GetSelectedTrack(-1, 0) or reaper.GetLastTouchedTrack() | ||
local id = 0 | ||
|
||
if first_sel_t then id = reaper.GetMediaTrackInfo_Value(first_sel_t, 'IP_TRACKNUMBER') end | ||
|
||
for i = id -2, 0, -1 do | ||
local t = reaper.GetTrack(-1, i) | ||
if reaper.IsTrackVisible(t, true) then | ||
reaper.SetOnlyTrackSelected(t) | ||
return | ||
end | ||
end | ||
end | ||
|
||
|
||
if focus == mixer_hwnd then | ||
reaper.Undo_BeginBlock() | ||
prev_in_mcp() | ||
reaper.Undo_EndBlock("Select Previous Track in Mixer", 0) | ||
else | ||
reaper.Main_OnCommand(40286, 0) | ||
end |