No internet connection
  1. Home
  2. How to

A pop up window interrupts a macro

By Dav3 @D_av_3
    2022-06-01 11:55:56.326Z

    Hello everybody. I have a small macro to batch process some regions in protools. There are three "PROCESS AUDIOSUITE PLUGIN" in succession. They all have "ClipbyClip" as inputMode. The first has "CreateIndividualFiles" as outputMode, while the second and third have "Overwrite files" as Output mode. Obviously when I launch the macro on the second operation a pop-up appears telling me "You can NOT undo a destructive edit .... bla bla bla" .. I can't find a way to automate the click on the "Continue" button and continue with the Macro .. I tried with Wait for UI Element and then Click UI Element ... but I had no luck .. would any of you know how to do it?

    • 6 replies
    1. Kitch Membery @Kitch2022-06-01 20:22:46.366Z

      This should do the trick :-)

      function dismissDialog(dialogText, buttonName) {
          const dlg = sf.ui.proTools.confirmationDialog;
          //Wait 100ms for dialog box to appear
         dlg.elementWaitFor({
              timeout: 100,
              pollingInterval: 10,
              onError: 'Continue'
          });
      
          if (dlg.children.whoseRole.is("AXStaticText").whoseValue.startsWith(dialogText).first.exists) {
              dlg.buttons.whoseTitle.is(buttonName).first.elementClick();
      
              dlg.elementWaitFor({
                  waitType: 'Disappear',
                  timeout: 100,
                  pollingInterval: 10,
                  onError: 'Continue'
              });
          }
      }
      
      //Activate Pro Tools main window
      sf.ui.proTools.appActivateMainWindow();
      
      //Click Render
      sf.ui.proTools.firstAudioSuiteWindow.buttons.whoseTitle.is("Render").first.elementClick();
      
      //Dismiss the Dialog
      dismissDialog("You can NOT undo a destructive edit.", "Continue");
      
      1. In reply toD_av_3:
        Dav3 @D_av_3
          2022-06-02 02:47:49.341Z

          Thank you Kitch!
          I converted the macro to script, and entered your code. unfortunately something is not working yet. did I do something wrong formatting the code?

          //EQ
          sf.ui.proTools.audioSuiteProcess({
             pluginCategory: "EQ",
             pluginName: "EQ3 7-Band",
             processingInputMode: "ClipByClip",
             processingOutputMode: "CreateIndividualFiles",
             presetMenuPath: ["EQ3_FULLIMPACT_CROWD"],
          });
          
          //MV2
          sf.ui.proTools.audioSuiteProcess({
             pluginCategory: "Dynamics",
             pluginName: "MV2",
             processingInputMode: "ClipByClip",
             processingOutputMode: "OverwriteFiles",
             presetMenuPath: ["MV2_FULL IMPACT_CROWD"],
             pollingInterval: 195,
          });
          
          function dismissDialog(dialogText, buttonName) {
             const dlg = sf.ui.proTools.confirmationDialog;
             //Wait 100ms for dialog box to appear
            dlg.elementWaitFor({
                 timeout: 100,
                 pollingInterval: 10,
                 onError: 'Continue'
             });
          
             if (dlg.children.whoseRole.is("AXStaticText").whoseValue.startsWith(dialogText).first.exists) {
                 dlg.buttons.whoseTitle.is(buttonName).first.elementClick();
          
                 dlg.elementWaitFor({
                     waitType: 'Disappear',
                     timeout: 100,
                     pollingInterval: 10,
                     onError: 'Continue'
                 });
             }
          }
          
          //Activate Pro Tools main window
          sf.ui.proTools.appActivateMainWindow();
          
          //Click Render
          sf.ui.proTools.firstAudioSuiteWindow.buttons.whoseTitle.is("Render").first.elementClick();
          
          //Dismiss the Dialog
          dismissDialog("You can NOT undo a destructive edit.", "Continue");
          
          //Inflator
          sf.ui.proTools.audioSuiteProcess({
             pluginCategory: "Harmonic",
             pluginName: "Scheps Omni Channel",
             processingInputMode: "ClipByClip",
             processingOutputMode: "OverwriteFiles",
             presetMenuPath: ["SCHEPS_FULL_IMPACT_CROWD"],
          });
          
          function dismissDialog(dialogText, buttonName) {
             const dlg = sf.ui.proTools.confirmationDialog;
             //Wait 100ms for dialog box to appear
            dlg.elementWaitFor({
                 timeout: 100,
                 pollingInterval: 10,
                 onError: 'Continue'
             });
          
             if (dlg.children.whoseRole.is("AXStaticText").whoseValue.startsWith(dialogText).first.exists) {
                 dlg.buttons.whoseTitle.is(buttonName).first.elementClick();
          
                 dlg.elementWaitFor({
                     waitType: 'Disappear',
                     timeout: 100,
                     pollingInterval: 10,
                     onError: 'Continue'
                 });
             }
          }
          
          //Activate Pro Tools main window
          sf.ui.proTools.appActivateMainWindow();
          
          //Click Render
          sf.ui.proTools.firstAudioSuiteWindow.buttons.whoseTitle.is("Render").first.elementClick();
          
          //Dismiss the Dialog
          dismissDialog("You can NOT undo a destructive edit.", "Continue");
          
          1. Kitch Membery @Kitch2022-06-02 19:26:29.431Z

            Ahh, yeah I see where it's going wrong...

            The method that you use to process the AudioSuite plugins performs the render function already so that needs to be removed.

            Untested, but this script should work;

            function dismissDialog(dialogText, buttonName) {
                const dlg = sf.ui.proTools.confirmationDialog;
                //Wait 100ms for dialog box to appear
                dlg.elementWaitFor({
                    timeout: 100,
                    pollingInterval: 10,
                    onError: 'Continue'
                });
            
                if (dlg.children.whoseRole.is("AXStaticText").whoseValue.startsWith(dialogText).first.exists) {
                    dlg.buttons.whoseTitle.is(buttonName).first.elementClick();
            
                    dlg.elementWaitFor({
                        waitType: 'Disappear',
                        timeout: 100,
                        pollingInterval: 10,
                        onError: 'Continue'
                    });
                }
            }
            
            function main() {
                //Activate Pro Tools main window
                sf.ui.proTools.appActivateMainWindow();
            
                //EQ
                sf.ui.proTools.audioSuiteProcess({
                    pluginCategory: "EQ",
                    pluginName: "EQ3 7-Band",
                    processingInputMode: "ClipByClip",
                    processingOutputMode: "CreateIndividualFiles",
                    presetMenuPath: ["EQ3_FULLIMPACT_CROWD"],
                });
            
                //MV2
                sf.ui.proTools.audioSuiteProcess({
                    pluginCategory: "Dynamics",
                    pluginName: "MV2",
                    processingInputMode: "ClipByClip",
                    processingOutputMode: "OverwriteFiles",
                    presetMenuPath: ["MV2_FULL IMPACT_CROWD"],
                    pollingInterval: 195,
                });
            
                //Dismiss the Dialog
                dismissDialog("You can NOT undo a destructive edit.", "Continue");
            
                //Inflator
                sf.ui.proTools.audioSuiteProcess({
                    pluginCategory: "Harmonic",
                    pluginName: "Scheps Omni Channel",
                    processingInputMode: "ClipByClip",
                    processingOutputMode: "OverwriteFiles",
                    presetMenuPath: ["SCHEPS_FULL_IMPACT_CROWD"],
                });
            
                //Dismiss the Dialog
                dismissDialog("You can NOT undo a destructive edit.", "Continue");
            }
            
            main();
            
            1. Dav3 @D_av_3
                2022-06-03 13:27:30.960Z

                Thank you Kitch!
                unfortunately nothing has changed.

                1. Kitch Membery @Kitch2022-06-03 18:38:33.321Z

                  Hi @Davide_Docente,

                  This will do the trick.

                  function dismissDialog(dialogText, buttonName) {
                      const dlg = sf.ui.proTools.confirmationDialog;
                      
                      //Wait 100ms for dialog box to appear
                      dlg.elementWaitFor({
                          timeout: 100,
                          pollingInterval: 10,
                          onError: 'Continue'
                      });
                  
                      if (dlg.children.whoseRole.is("AXStaticText").whoseValue.startsWith(dialogText).first.exists) {
                          dlg.buttons.whoseTitle.is(buttonName).first.elementClick();
                  
                          dlg.elementWaitFor({
                              waitType: 'Disappear',
                              timeout: 100,
                              pollingInterval: 10,
                              onError: 'Continue'
                          });
                      }
                  }
                  
                  function audioSuiteProcessDestructive(props) {
                      const { pluginCategory, pluginName, processingInputMode, processingOutputMode, presetMenuPath, } = props;
                  
                      const asWin = sf.ui.proTools.audioSuiteOpenPlugin({
                          category: pluginCategory,
                          name: pluginName,
                      }).window
                  
                      asWin.audioSuiteSetOptions({
                          processingInputMode: processingInputMode,
                          processingOutputMode: processingOutputMode,
                      });
                  
                      asWin.audioSuiteSelectPreset({
                          presetMenuPath: presetMenuPath
                      });
                  
                      asWin.renderButton.elementClick();
                  
                      dismissDialog("You can NOT undo a destructive edit.", "Continue");
                  
                      sf.ui.proTools.waitForNoModals();
                  }
                  
                  function main() {
                      //Activate Pro Tools main window
                      sf.ui.proTools.appActivateMainWindow();
                  
                      //EQ
                      sf.ui.proTools.audioSuiteProcess({
                          pluginCategory: "EQ",
                          pluginName: "EQ3 7-Band",
                          processingInputMode: "ClipByClip",
                          processingOutputMode: "CreateIndividualFiles",
                          presetMenuPath: ["EQ3_FULLIMPACT_CROWD"],
                      });
                  
                      //MV2
                      sf.ui.proTools.audioSuiteProcess({
                          pluginCategory: "Dynamics",
                          pluginName: "MV2",
                          processingInputMode: "ClipByClip",
                          processingOutputMode: "OverwriteFiles",
                          presetMenuPath: ["MV2_FULL IMPACT_CROWD"],
                          pollingInterval: 195,
                      });
                  
                      //Inflator
                      sf.ui.proTools.audioSuiteProcess({
                          pluginCategory: "Harmonic",
                          pluginName: "Scheps Omni Channel",
                          processingInputMode: "ClipByClip",
                          processingOutputMode: "OverwriteFiles",
                          presetMenuPath: ["SCHEPS_FULL_IMPACT_CROWD"],
                      });
                  }
                  
                  main();
                  

                  Let me know how it runs :-)

            2. In reply toD_av_3:
              Dav3 @D_av_3
                2022-06-03 19:56:28.748Z

                We haven't solved the problem yet.
                Maybe a protools setting is blocking your script? Did you have the opportunity to test the script ??