01-05-2022, 05:38 PM
|
#16
|
Human being with feelings
Join Date: Nov 2020
Posts: 35
|
Quote:
Originally Posted by sockmonkey72
That's just superstition and stubbornness talking. The script API is there to make REAPER work the way you think it should -- the ReaScript docs are in the top-level Help menu for a reason.
As for the problem at hand, yes, I think this could be solved with a script.
InsertTrackRespectingFolderEnd.eel
Code:
// InsertTrackRespectingFolderEnd.eel
// v0.1, 2021.1.5
// sockmonkey72 / Jeremy Bernstein
// Inserts track(s) to the right of the selected track(s)
// if the selected track is the end of a folder, the new track
// will be created inside of that folder
ct = CountSelectedTracks(0);
i = 1;
loop(ct,
tr = GetSelectedTrack(0, ct - i); // iterate backward since we're modifying the selection
tr ? (
trnum = GetMediaTrackInfo_Value(tr, "IP_TRACKNUMBER"); // 1-based
InsertTrackAtIndex(trnum, 1); // 0-based, so we can use the same number
newtr = GetTrack(0, trnum);
trdepth = GetMediaTrackInfo_Value(tr, "I_FOLDERDEPTH");
trdepth < 0 ? (
SetMediaTrackInfo_Value(newtr, "I_FOLDERDEPTH", trdepth);
SetMediaTrackInfo_Value(tr, "I_FOLDERDEPTH", 0);
);
SetTrackSelected(tr, 0);
SetTrackSelected(newtr, 1);
);
i += 1;
);
|
Thank you. I knew I could do something with scripts, but I didn't know how much I could do. Because I was able to overcome most of the problems by doing some research on the forum. This reply renewed my curiosity and encouraged me to take the next step in Reaper. Also ReaScript documentation is amazing.
|
|
|