No internet connection
  1. Home
  2. How to

Toggle Preset for TC/E in Preferences?

By Owen Granich-Young @Owen_Granich_Young
    2021-10-21 16:37:53.133Z

    I would like to be able to switch my TCE tool between two settings, depending on need, a Vari-Fi, and a regular.

    Through Marco I've managed to put this on two seperate buttons, but I need a little help making it a Toggle instead.
    Is this something I could do via Macro's and I'm using the wrong Popup menu macro? Or at that point does it need to be coded?

    You'll see two different 'Open & Select Item in Popup Menu' commands currently in the Macro because I just duplicated the button and toggled off the other for the 2nd button. (TBH I was kind of hoping the single button could just ignore the one macro command that doesn't work and push through to the other the first time I built it but obvisouly that didn't work.)

    Can somebody show me the way?

    Thanks!
    Owen

    
    sf.ui.proTools.menuClick({
        menuPath: ["Pro Tools","Preferences..."],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Pro Tools | Ultimate Preferences").first.elementWaitFor();
    
    sf.ui.proTools.windows.whoseTitle.is("Pro Tools | Ultimate Preferences").first.radioButtons.whoseTitle.is("Processing 6 of 9").first.elementClick();
    
    sf.ui.proTools.windows.whoseTitle.is("Pro Tools | Ultimate Preferences").first.groups.whoseTitle.is("TC/E").first.popupButtons.whoseTitle.is("Voice Default").first.popupMenuSelect({
        menuPath: ["Vari Default"],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Pro Tools | Ultimate Preferences").first.groups.whoseTitle.is("TC/E").first.popupButtons.whoseTitle.is("Vari Default").first.popupMenuSelect({
        menuPath: ["Voice Default"],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Pro Tools | Ultimate Preferences").first.buttons.whoseTitle.is("OK").first.elementClick();
    
    
    Solved in post #5, click to view
    • 7 replies
    1. Which TC/E plugin are you using? I don't see any menu for Voice Default or Vari Default.
      Once I know this I can help you out.

      1. O

        Thanks Chris! I'm using Pitch 'n Time Pro. These are just two preset in there I made for ADR and Vari-Fi

        That useful info?

        1. You could code it literally 'preset 1' and 'preset 2' and I can fill in the names from there if that helps?

        2. Chris Shaw @Chris_Shaw2021-10-21 23:38:43.605Z2021-10-21 23:56:34.576Z

          here you go. Just change the names of the plugin and presets.
          The script will also make sure the correct TCE plugin is selected.

          // Define TCE plugin
          const tcePlugin = "Avid Time Shift"
          
          // define presets
          const preset1 = "Bass Monophonic";
          const preset2 = "Guitar";
          
          // define prefs window and open it
          const prefsWindow = sf.ui.proTools.windows.whoseTitle.is("Pro Tools | Ultimate Preferences").first;
          
          sf.ui.proTools.menuClick({
              menuPath: ["Pro Tools", "Preferences..."],
          });
          
          prefsWindow.elementWaitFor();
          
          // Open Processing tab
          prefsWindow.radioButtons.whoseTitle.is("Processing 6 of 9").first.elementClick();
          
          // Select TCE plugin
          //    check if desired plugin is selected and select it if necessary
          const currentTCEPlugin = prefsWindow.groups.whoseTitle.is("TC/E").first
              .popupButtons.whoseDescription.is("").first.value.invalidate().value;
          
          if (currentTCEPlugin != tcePlugin) {
              prefsWindow.groups.whoseTitle.is("TC/E").first.popupButtons.whoseDescription.is("").first.popupMenuSelect({
                  menuPath: [tcePlugin],
              });
          };
          
          // get current preset
          var currentTCEPreset = prefsWindow.groups.whoseTitle.is("TC/E").first
              .popupButtons.allItems[1].value.invalidate().value;
          
          
          // Toggle Preset
          prefsWindow.groups.whoseTitle.is("TC/E").first.popupButtons.allItems[1].popupMenuSelect({
              menuPath: (currentTCEPreset == preset1) ? [preset2] : [preset1]
          });
          
          // Close Prefs window
          prefsWindow.buttons.whoseTitle.is("OK").first.elementClick();
          
          

          the key part to toggling is this line:
          menuPath: (currentTCEPreset == preset1) ? [preset2] : [preset1]

          (currentTCEPreset == preset1) ? [preset2] : [preset1] is a ternary operator which is just a shorter way of writing if (currentTCEPreset == preset1) return preset2 else return preset1

          ReplySolution
          1. Brilliant! Thanks! Gonna take it for a test drive now!

            1. In reply toChris_Shaw:

              Oops! I made a slight error. Fixed above

              1. It works it works! Thanks boss!