Old 04-21-2017, 01:18 PM   #1
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default Help refine select items in folder script

Below is a script spk77 made that I use all the time for making items behave as if they are grouped if they're in a folder (it's my default click select).

The first refinement I'd like to make is this: If I click an item that is shorter than other parallel items in the folder then only the items that start and end in exactly the same place as the short one are selected in the folder.

The second refinement is that if I click an item in the folder and there are several shorter items within it's length on other tracks in the folder, then all the items within the start and end points of the selected item on the other tracks are selected.

Thirdly if I click an item that is shorter than some parallel items but longer than others within it's own length then both the above rules apply to the various length items comparatively (selecting the item I click, not any longer ones but include other items within the length of the item I've clicked that are on parallel tracks in the folder.

Phew!

Any clarification needed? Shout me!

Many thanks



Code:
Undo_BeginBlock2(0);
last_touched_track = GetLastTouchedTrack();

i = 0;
cur_depth = 0;
is_child_track = 0;
tr_c = CountTracks(0);

while(is_child_track == 0 && i < tr_c) (
  track = GetTrack(0, i);
  depth_change = GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH");
  cur_depth += depth_change;
  track == last_touched_track && depth_change <= 0 && cur_depth >= 0 ? is_child_track = 1;
  cur_depth == 0 && depth_change == 0 ? is_child_track = 0;
  i += 1;
);

PreventUIRefresh(1);
is_child_track == 1 ? (
  Main_OnCommand(NamedCommandLookup("_SWS_SELPARENTS2"), 0);
  Main_OnCommand(NamedCommandLookup("_SWS_SELCHILDREN"), 0); // sel only children tracks
  Main_OnCommand(NamedCommandLookup("_XENAKIOS_SELITEMSUNDEDCURSELTX"), 0);
) : SetOnlyTrackSelected(last_touched_track);
PreventUIRefresh(-1);

Undo_EndBlock2(0, "Select items under edit cursor (in a folder)", -1);
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com

Last edited by Triode; 04-21-2017 at 01:21 PM. Reason: typo
Triode is offline   Reply With Quote
Old 05-19-2017, 07:35 AM   #2
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Any help with this would be very welcome.
I have no coding knowledge whatsoever!
Many thanks for your time if you have it.
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.