Old 10-02-2019, 12:56 AM   #1
semikid
Human being with feelings
 
Join Date: May 2015
Location: Los Angeles, CA
Posts: 326
Default "Unselect tracks-with the name of ___"

I'm looking for a script to make or someone make me one that I can interchange what I want the name in the track to be unselected.

For example: "unselect tracks with the name bass" OR "unselect tracks with the name guitar"

etc.
semikid is offline   Reply With Quote
Old 10-02-2019, 01:32 AM   #2
uncleswede
Human being with feelings
 
Join Date: Feb 2015
Posts: 1,096
Default

If you have the SWS extension installed, you can do this with CYCLE ACTIONS...

Create a new cycle action named, for example, "Unselect Bass" with an action as follows:

CONSOLE -sBass*

This will unselect all tracks whose name begins with 'Bass' (or 'bass')

Once you created and applied this cycle action it will appear as an action in your Action List named "Unselect Bass" :-)
uncleswede is offline   Reply With Quote
Old 10-07-2019, 02:33 PM   #3
semikid
Human being with feelings
 
Join Date: May 2015
Location: Los Angeles, CA
Posts: 326
Default

hey that helps, but not for the children tracks specifically under the parent folders name. I need to unselect all the tracks underneath that track name as well. Not just the parent folder/track. ALL of them.

More of a "select all tracks, but "fx buses" tracks (and their children folders/tracks)

Last edited by semikid; 10-07-2019 at 02:43 PM.
semikid is offline   Reply With Quote
Old 10-07-2019, 02:55 PM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

How about something like this?, If it does what you want you could change the find name and save as another script,.
Code:
-- Unselect tracks with specific name

local find = 'Guitar' -- non-case sensitive

reaper.PreventUIRefresh(1)
for i = reaper.CountSelectedTracks(0)-1,0,-1 do 
  local track = reaper.GetSelectedTrack(0, i)
  local _,name = reaper.GetTrackName(track, '')
  if string.lower(name) == string.lower(find) then    
    reaper.SetTrackSelected(track, false)
  end   
end
reaper.PreventUIRefresh(-1)
Removed Undo code, REAPER doesn't seem to support undo for selected track?

Last edited by Edgemeal; 10-07-2019 at 03:07 PM.
Edgemeal is offline   Reply With Quote
Old 10-08-2019, 11:22 AM   #5
semikid
Human being with feelings
 
Join Date: May 2015
Location: Los Angeles, CA
Posts: 326
Default

Thanks for the help Edgemeal. Right now it only seems to be unselecting the parent fx bus track and not the children.
semikid is offline   Reply With Quote
Old 10-08-2019, 03:10 PM   #6
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by semikid View Post
Thanks for the help Edgemeal. Right now it only seems to be unselecting the parent fx bus track and not the children.
Well the script just unselects any selected track that has a matching name, but I'm guessing what you really want is, all child tracks of the matching parent name get also get unselected?

Also, what is supposed to happen if a child track is selected and has the matching name but the parent doesn't?

You might want to update your original post so its more clear to others.

Last edited by Edgemeal; 10-08-2019 at 03:37 PM.
Edgemeal is offline   Reply With Quote
Old 10-08-2019, 04:21 PM   #7
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

I have a script on ReaPack called Select tracks by name... if I get a chance, I'll try to add an "inverse" mode that should do what you need.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-08-2019, 09:02 PM   #8
semikid
Human being with feelings
 
Join Date: May 2015
Location: Los Angeles, CA
Posts: 326
Default

Quote:
Originally Posted by Lokasenna View Post
I have a script on ReaPack called Select tracks by name... if I get a chance, I'll try to add an "inverse" mode that should do what you need.
Ha! yes i love that script! I was thinking exactly that! "what if this script could inverse?"

That would be sweet if possible! LMK!
semikid is offline   Reply With Quote
Old 11-08-2019, 09:09 PM   #9
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 10,272
Default

Or just use the console command -s trackname

You don't need to use Cycle Actions to run console commands, unless you want to combine them with other commands. You could e.g. select your tracks with the above command and add the sws action "unselect children of selected folder."
__________________
foxyyymusic
foxAsteria is offline   Reply With Quote
Old 10-23-2023, 06:55 AM   #10
robotron
Human being with feelings
 
Join Date: May 2020
Posts: 337
Default

I'd really like to be able to do this as well (unselect tracks by name, including all children).

The only way I've found so far to choose specific tracks to unselect in an action is using the Reapack script 'Script: X-Raym_Unselect tracks with certain words in their SWS notes.lua'.

EDIT: I don't think the '-s trackname' solution would work for me as I want to unselect from a set of tracks that have been selected mid-way through a custom action.
robotron is offline   Reply With Quote
Old 10-25-2023, 06:58 AM   #11
Laz Rood
Human being with feelings
 
Laz Rood's Avatar
 
Join Date: Oct 2023
Posts: 3
Default

Hello. With the help of ChatGPT I get this script. I tested it with parent and children tracks successfully. Give it a try. Just change the name between "xxx" for the track name you want.

Code:
-- Function to unselect all tracks with the word "stem" in their name, case-insensitive
function unselectTracksWithStem()
    -- Get the number of tracks
    local num_tracks = reaper.CountTracks(0)
    -- Loop through all tracks
    for i = 0, num_tracks - 1 do
        -- Get the current track
        local track = reaper.GetTrack(0, i)
        -- Get the track name
        local retval, track_name = reaper.GetTrackName(track)
        -- Just change the name between "xxx" and save the script
        if string.find(string.lower(track_name), "stem") then
            -- Unselect the track
            reaper.SetTrackSelected(track, false)
        end
    end
end

-- Call the function to unselect all tracks with the word "stem" in their name, case-insensitive
unselectTracksWithStem()
Laz Rood 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 04:17 PM.


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