No internet connection
  1. Home
  2. How to

Toggle Between Automation Modes

By Daniel Knobler @Daniel_Knobler
    2022-07-26 21:57:53.461Z

    Hello,

    Does anyone have a command to toggle between two automation modes for selected tracks? Preferably toggle between READ AND TOUCH.

    Thanks!

    • 2 replies
    1. Chris Shaw @Chris_Shaw2022-08-01 22:06:40.153Z2022-08-01 22:20:15.717Z

      Sorry for the late reply.
      Try this.
      Just change primaryMode and secondaryMode to whatever two automation modes you want to toggle between.

      // Check if tracks are selected
      if (sf.ui.proTools.selectedTrackCount == 0) {
        sf.interaction.notify({ title: "Toggle Automation Mode", message: "No Tracks selected" });
        throw 0
      };
      
      // possible auto modes: read - touch - latch - touch/latch - write
      
      const primaryMode = "read"
      const secondaryMode = "touch"
      
      //Read automation mode of first selected track
      const currentAutoMode = sf.ui.proTools.selectedTrack.automationModeButton.value.invalidate().value
      
      //Determine which mode to switch to
      const newMode = (currentAutoMode.includes(primaryMode)) ? secondaryMode : primaryMode
      
      // Set automation mode for all selected tracks
      sf.ui.proTools.selectedTrack.automationModeSet({
        automationModeName: newMode,
        trackTargetMode: "SelectedTracks",
      });
      
      1. You should probably have another trigger to toggle trim on / off:

        // Check if tracks are selected
        if (sf.ui.proTools.selectedTrackCount == 0) {
          sf.interaction.notify({ title: "Toggle Automation Mode", message: "No Tracks selected" });
          throw 0
        };
        
        // Toggle trim on/off
        sf.ui.proTools.selectedTrack.automationModeSet({
          automationModeName: "trim",
          trackTargetMode: "SelectedTracks",
        });