No internet connection
  1. Home
  2. Support

How to Toggle Zoom if it's already active

By alex alcanjim @alex_alcanjim
    2020-09-24 10:00:01.812Z

    Hi all,

    Just looking to improve my zoom workflow on Pro Tools using "Zoom Toggle" tool.

    I just want to create a macro that active "Zoom Toggle", but I need something else. I want this macro to check if "Zoom Toggle" is active or not before run the macro.

    Then, if "Zoom Toggle" is active, I want to de-activate it and, then, active it again. And if it is disable, just active it.

    Any idea about how to create this script?

    Thanks in advance for the help!

    • 1 replies
    1. Something like this should work :)

      
      const zoomToggleButton = sf.ui.proTools.mainWindow.cursorToolCluster.zoomToggleButton;
      
      let isZoomToggleOn = zoomToggleButton.value.invalidate().value === 'Selected';
      if (isZoomToggleOn) {
          zoomToggleButton.elementClick();
          zoomToggleButton.elementClick();
      } else {
          zoomToggleButton.elementClick();
      }