No internet connection
  1. Home
  2. Macro and Script Help

Very simple script not working anymore after upgrading Mac OS

By Matt Ch @Matt_Ch
    2025-02-04 16:07:37.950Z

    Title

    Very simple script not working anymore after upgrading Mac OS

    What do you expect to happen when you run the script/macro?

    This script is supposed to selected the previous element in Auto-align Post Key Input menu from the Audiosuite plugin.

    It used to work perfectly within mac OS Ventura and older. It doesn't work anymore in Sonoma or Sequoia, and I can't figure out why.

    Are you seeing an error?

    What happens when you run this script?

    It select a random key input track from the list (more often than not it select the very first one). It should select the track preceding the actually selected one in the dropdown menu.

    How were you running this script?

    I used a keyboard shortcut within the target app

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "This script is supposed to selected the previous element in Auto-align Post Key Input menu from the Audiosuite plugin.\n\nIt used to work perfectly within mac OS Ventura and older. It doesn't work anymore in Sonoma or Sequoia, and I can't figure out why.",
        "inputIsError": false,
        "inputWhatHappens": "It select a random key input track from the list (more often than not it select the very first one). It should select the track preceding the actually selected one in the dropdown menu.",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 5,
        "inputTitle": "Very simple script not working anymore after upgrading Mac OS"
    }

    Source

    //This script selects the previous track as a key track
    
    sf.ui.proTools.appActivateMainWindow();
    
    if (sf.ui.proTools.floatingWindows.whoseTitle.contains('Auto-Align Post').exists) {
        sf.ui.proTools.floatingWindows.whoseTitle.contains('Auto-Align Post').first.elementRaise();
    
    } else {
        sf.ui.proTools.audioSuiteOpenPlugin({
            category: "Other",
            name: "Auto-Align Post",
        });
    
        sf.ui.proTools.windows.whoseTitle.is("Audio Suite: Auto-Align Post").first.buttons.whoseTitle.is("Target button").first.elementClick();
        sf.ui.proTools.firstAudioSuiteWindow.audioSuiteSetOptions({
            processingInputMode: "ClipByClip",
            processingOutputMode: "CreateIndividualFiles",
        });
    }
    
    sf.ui.proTools.windows.whoseTitle.is("Audio Suite: Auto-Align Post").first.popupButtons.allItems[4].mouseClickElement({
        anchor: "MidCenter",
        isRightClick: false,
    });
    
    sf.keyboard.press({
        keys: "up",
        fast: false,
        executionMode: "Foreground",
    });
    
    sf.keyboard.press({
        keys: "return",
    });
    

    Links

    User UID: WagHEQVuNFMMnDQptgLDx7rMPtI3

    Feedback Key: sffeedback:WagHEQVuNFMMnDQptgLDx7rMPtI3:-OIGhtWugL7bTqBZzZ9Y

    Feedback ZIP: Y0nDXZ/dO3/CTWIEMkkyVvNgUr0NHCQOUV9KhK4audG/YY6o9uEbCjDQchf6aZHN895dHtGEW94/Pp7pukLO84ihmisAcca9y6gf3EkpkIW14CdGSttt+dzeU2nDsnWSylgH8Sq1QkbpZrRuBcQ7O6BEiLk1rbNPAhGyoLEp2gkGGzbuiMgnt6fpb0w2Z2D7uQQY71sy5a5uAV6OmxfZlEkXW9fi8d2riZgFJFaOp3W0xWFJ6VibYAQmCogn7zjzh/0BwZrGzp0ZPAbRP1QmSZ/cOlqsWKknN4/rcnkHUT0S+1glMGlcQ0ochNiU2liDouqYRs2EjdHBzjH6xTKnjw==

    • 2 replies
    1. Hey @Matt_Ch,

      I don't own Auto-Align Post so I'm not able to test this script.
      I refactored it a bit to make it easier to read, added a function to select the track above or below the selected track (instead of using keyboard presses), and added an elementWaitFor to wait for the AS window to open.

      Hopefully this helps.

      function selectNextOrPrevAdjacentTrack(prevOrNext) {
          const visibleTrackNames = sf.ui.proTools.visibleTrackNames;
          const selectedTrackName = sf.ui.proTools.selectedTrackNames[0];
          const selectedTrackIndex = visibleTrackNames.indexOf(selectedTrackName);
          const newIndex = prevOrNext == "prev" ? selectedTrackIndex - 1 : selectedTrackIndex + 1;
      
          if (newIndex >= 0 && newIndex <= visibleTrackNames.length - 1) {
              sf.ui.proTools.trackSelectByName({ names: [visibleTrackNames[newIndex]] })
          }
      }
      
      sf.ui.proTools.appActivateMainWindow();
      
      const autoAlignWindow = sf.ui.proTools.floatingWindows.whoseTitle.contains('Auto-Align Post').first;
      
      if (autoAlignWindow.exists) {
          autoAlignWindow.elementRaise();
      
      } else {
          sf.ui.proTools.audioSuiteOpenPlugin({
              category: "Other",
              name: "Auto-Align Post",
          });
      
          autoAlignWindow.elementWaitFor({ waitType: "Appear" });
      
          autoAlignWindow.buttons.whoseTitle.is("Target button").first.elementClick();
          sf.ui.proTools.firstAudioSuiteWindow.audioSuiteSetOptions({
              processingInputMode: "ClipByClip",
              processingOutputMode: "CreateIndividualFiles",
          });
      }
      
      autoAlignWindow.popupButtons.allItems[4].mouseClickElement({
          anchor: "MidCenter",
          isRightClick: false,
      });
      
      selectNextOrPrevAdjacentTrack("prev")
      
      sf.keyboard.press({
          keys: "return",
      });
      
      1. O
        In reply toMatt_Ch:

        Here are some other stable auto align scripts Auto_Align Post Macro by @Owen_Granich_Young #post-2