No internet connection
  1. Home
  2. How to

Skipping selectrion to track Y if track X doesn't exist

By Dario Ramaglia @dario.ramaglia
    2019-04-18 14:31:18.630Z

    I was to add the ALTERNATE MUTE/SOLO script to another script. Maybe you could help me with that.
    I would like to tell the script to look for a track call X (in my case "Audio Guide"), if it doesnt find X then it should search for 2 track Y & Z (in my case "Dialogue Guide" and "Music Guide"), then apply the ALTERNATE MUTE/SOLO script.

    Thank in advance and, as usual, I hope this will help other users too.

    Cheers

    Solved in post #2, click to view
    • 13 replies
    1. Christian Scheuer @chrscheuer2019-04-18 20:12:26.718Z2019-04-18 20:18:35.657Z

      Something like this should work:

      
      function findTrack(candidates) {
          for (var i = 0; !track && i < candidates.length; i++) {
              var track = sf.ui.proTools.trackGetByName({
                  name: candidates[i],
                  makeVisible: true
              }).track;
          }
          if (!track) throw 'Could not find any of the tracks specified: ' + candidates.join(', ');
          return track;
      }
      
      var track = findTrack([
          'Audio Guide',
          'Dialogue Guide',
          'Music Guide'
      ]);
      
      if (track.isMuted)
      {
          track.trackSetSolo({ targetValue: 'Enable' });
          track.trackSetMute({ targetValue: 'Disable' });
      }
      else if (track.isSoloed)
      {
          track.trackSetSolo({ targetValue: 'Disable' });
          track.trackSetMute({ targetValue: 'Enable' });
      }
      else
      {
          track.trackSetSolo({ targetValue: 'Enable' });
          track.trackSetMute({ targetValue: 'Disable' });
      }
      
      
      ReplySolution
      1. Note, this script is looking for the tracks in succession and will then toggle solo/mute states on the first of the tracks that it finds, in the order they are specified. This implies that you'd only have one of those tracks in a session. Not sure I completely follow your workflow - wouldn't you normally have both an Dialogue Guide and a Music Guide in the same session, or am I misunderstanding something?

        1. Dario Ramaglia @dario.ramaglia
            2019-04-19 05:38:45.153Z

            I just tried this and it works great. It allowed me to encounter a ProTools bug that I already encountered a while ago.
            I tried to change one of the 3 tracks' name to a random letter and the script still works on that track.
            Seems like even if it shows another name, PT need you to close and open the session to really rename it.

            1. This to me sounds more like you're hitting SoundFlows cache. You reset the cache by hitting Ctrl Q with default triggers (SoundFlow Reset command)

              1. Dario Ramaglia @dario.ramaglia
                  2019-04-19 06:21:21.899Z

                  Yes, probably that, because it happened to me only with SoundFlow ;)

                  1. If you need the script to invalidate the cache, you can add this to the top of the script:

                    sf.ui.proTools.mainWindow.invalidate();

                    1. Note this will make stuff slower on large sessions :)

                      1. Dario Ramaglia @dario.ramaglia
                          2019-04-19 06:31:55.824Z

                          Yep, you taught me that a long time ago ;) No need, I hardly change the name of the tracks in my template.

            2. Progress
            3. D
              Davide Favargiotti @dieffe
                2019-04-18 20:18:53.984Z

                I would split the script in two scripts, using globalvariables to pass the informations (the track name to solo).
                So basically you should have a script that toggle solo/mute for the track in the globalstate variable. And another script that looks for the tracks and then put that track in the global state variable and then launch the solo/mute script.

                Hope this makes sense

                1. Christian Scheuer @chrscheuer2019-04-18 20:23:10.166Zreplies todieffe:

                  This sounds like a good idea yet I don't follow the workflow completely :) Haha but then again I'm also not sure I understood @dario.ramaglia's original intention/workflow.

                  1. Dario Ramaglia @dario.ramaglia
                      2019-04-18 20:32:24.295Z

                      Here I am, it was kinda difficult to reply from my mobile. At the moment I have a script to mute/solo my AUDIO GUIDE track but...
                      In my template I have 3 different tracks:

                      • Audio Guide (Stereo) : for stereo mixdown guide tracks
                      • Dialogue and Music Guide ( two Mono ) : when I receive Dialogues on the Left channel and Music on the Right Channel.

                      They are there and i simply de-activate or delete the ones I dont use for that project.

                      What I'm tryin to do is not have 3 different buttons on the streamdeck but have 1 button that will mute/solo what is in that particular session.

                      I hope i explained myself, I just finished to conform 355 changes on a session :( I hope i wrote in English too

                      1. Haha. Okay then I seem to have understood your question right. Hopefully the above script works for you then.

                        1. D
                          Davide Favargiotti @dieffe
                            2019-04-18 20:36:29.635Z

                            My idea is to make modular, so that the script for toggling between solo/mute of one track can be called and used for whatever track(s) you want.

                            You launch the script the script that search for the named track(s) and then that script will pass the tracknames to a globalstate variable and launch the solo/mute script.
                            I’m not at the computer otherwise I would write it the two scripts, they’re fairly easy once the solo/mute routine works for one track (I think).