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

Clear Insert Script is not working

By Volker Hinkel @Volker_Hinkel
    2024-03-11 16:23:08.756Z

    Title

    Clear Insert Script is not working

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

    Hi, this script did clear the inserts... and is no longer working

    thanx

    Are you seeing an error?

    What happens when you run this script?

    error message

    How were you running this script?

    I clicked the "Run Script" or "Run Macro" button in SoundFlow

    How important is this issue to you?

    3

    Details

    {
        "inputExpected": "Hi,\nthis script did clear the inserts...\nand is no longer working\n\nthanx\n\n",
        "inputIsError": true,
        "inputWhatHappens": "error message",
        "inputHowRun": {
            "key": "-MpfwYA4I6GGlXgvp5j1",
            "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow"
        },
        "inputImportance": 3,
        "inputTitle": "Clear Insert Script is not working"
    }

    Source

    const sup = sf.ui.proTools
    sup.appActivateMainWindow();
    sup.mainWindow.invalidate();
    var originallySelectedTrackNames = sup.selectedTrackNames;
    function ensureFirstSelectedTrackIsVisible() {
        sup.trackSelectByName({names:[originallySelectedTrackNames[0]]})
        sup.selectedTrack.trackScrollToView();
        sup.trackSelectByName({ names: originallySelectedTrackNames, deselectOthers: true });
    }
    function clearInserts() {
        sup.selectedTrack.titleButton.popupMenuSelect({
            isRightClick: true,
            menuPath: ['Recall Track Preset', 'SoundFlow', 'No Inserts']
        });
    }
    function main() {
        // Check that SoundFLow Track Presets exists in user's directory
        if (!sf.file.exists({
            path: "~/Documents/Pro Tools/Track Presets/SoundFlow/SF Temp Track Preset.ptxp"
        }).exists) {
            alert("Please run the \"1) Create SoundFlow Track Presets\" script located in the " +
                "Track Data Utilities Package before using any Track Data Utilities commands.");
            throw 0
        }
        if (sup.getMenuItem('Window', 'Mix').isMenuChecked) {
            sup.menuClick({
                menuPath: ["Window", "Edit"],
                targetValue: "Enable",
            });
            ensureFirstSelectedTrackIsVisible();
            clearInserts();
            sup.menuClick({
                menuPath: ["Window", "Mix"],
                targetValue: "Enable",
            });
            sup.trackSelectByName({ names: originallySelectedTrackNames, deselectOthers: true });
        }
        else {
            ensureFirstSelectedTrackIsVisible();
            clearInserts();
            sup.trackSelectByName({ names: originallySelectedTrackNames, deselectOthers: true });
        }
    }
    main();
    

    Links

    User UID: V6kF9O3pc1ftdCmW4RM19cznTEN2

    Feedback Key: sffeedback:V6kF9O3pc1ftdCmW4RM19cznTEN2:-NsiJnFPbzFrzKDN99YT

    Feedback ZIP: Z2ZYzLsJTJOrIsM0O4UG+7xkLK/aI619MnFEdBo1DApMLXqdCB4dUsQCzY7TDwzqrJ6zdD5RwySfmI5FVhA3dGwNFNDLRRYKS7YfgsYXX/4TaatECBP32D80yjtbmjZ/eVlyxNRsKTLbdL5+OeSxsfZfMMbO0HJbQ4sPNqQw0COruKhJihGW1VSp/JHXu6Iuvces9pZ4bOkkN5wRKcJNW8Jx9ktoXUjB3p08V2n0glHfYbBDAeVp6dIu+wO9cHNeMp/fRiBJoWqf31xSRAdfoNfCZ2jGXUZWFezXj79pVWgoZAE8ZFJOA+hWQB2o57sojJk8YbjpfjIPgwx16VlS5Q==

    • 5 replies
    1. Chad Wahlbrink @Chad2024-03-11 19:39:11.127Z

      Hey @Volker_Hinkel!

      As @raphaelsepulveda points out in this thread - starting on PT 2024.3, a small offset is now required for any script that interacts with a track's title button right-click popup menu.

      Add a relativePosition of { x: 5, y: 5 } to get your scripts back in working order, like so:

      const sup = sf.ui.proTools
      
      function clearInserts() {
          sup.selectedTrack.titleButton.popupMenuSelect({
              isRightClick: true,
              relativePosition: {x:5, y:5},
              menuPath: ['Recall Track Preset', 'SoundFlow', 'No Inserts']
          });
      }
      
      clearInserts();
      
      1. Volker Hinkel @Volker_Hinkel
          2024-03-12 09:41:48.644Z

          Hi Chad,
          wow !
          it works great now.
          Thank you for this quick response !
          cheers volker

        • S
          In reply toVolker_Hinkel:
          SoundFlow Bot @soundflowbot
            2024-03-11 20:16:33.317Z

            This report was now added to the internal issue tracked by SoundFlow as SF-869

            1. S
              In reply toVolker_Hinkel:
              SoundFlow Bot @soundflowbot
                2024-03-14 19:39:34.349Z

                Linked issue SF-869 updated: This issue should now be resolved in SoundFlow 5.7.1 which is available as a manual download from https://my.soundflow.org - We changed the behavior of popupMenuSelect ("Open & Select Item in Popup Menu") so that it simulates a mouse click in the center of the button, instead of in the top-left corner. This should ensure that buttons with non-clickable borders, like certain track-related buttons in recent versions of Pro Tools, will keep working without having to set up custom offsets.

                1. S
                  In reply toVolker_Hinkel:
                  SoundFlow Bot @soundflowbot
                    2024-03-14 19:39:37.476Z

                    The linked internal issue SF-869 has been marked as Done