No internet connection
  1. Home
  2. How to

Wait for audiosuite process to finish

By Chip Sloan @ChipSloan
    2020-10-01 01:40:10.834Z

    I've searched and cannot quite find the answer for this one. I've got a script working where I do a gain change process on files and then want to open the batch renaming function. I've got it working by placing a wait for 3333 ms after the gain function before the key command to launch the batch renamer. I'm wondering if there is a wait script that would wait for the audiosuite gain function to finish before pushing the key command. I found the process for bouncing but it's not working for me. Thoughts?

    Solved in post #4, click to view
    • 10 replies
    1. Kitch Membery @Kitch2020-10-01 02:22:08.217Z

      Hi Chip...

      Simply use the "Wait for Modals" action in the macro editor instead of the 3333ms wait or the following code;

      sf.ui.proTools.waitForNoModals();
      

      Let me know if that works for you :-)

      Rock on!

      1. Chip Sloan @ChipSloan
          2020-10-01 02:29:01.951Z2020-10-01 02:41:30.235Z

          I had tried that but I get an error. Perhaps I have a syntax error somewhere??
          Here's my script attempt, it works with the ms wait but if I comment that and replace with the modal script it errors.

          sf.ui.proTools.appActivateMainWindow();
          
          var asWin = sf.ui.proTools.getAudioSuiteWindow("Gain");
          if (!asWin.exists) {
              asWin = sf.ui.proTools.audioSuiteOpenPlugin({
                  category: 'Other',
                  name: "Gain"
              }).window;
              
          }
          
          asWin.audioSuiteSetOptions({
                  processingInputMode: "ClipByClip",
                  processingOutputMode: "CreateIndividualFiles",
              });
          
          sf.ui.proTools.firstAudioSuiteWindow.buttons.whoseTitle.is('Render').first.elementClick();
          
          //sf.wait({
          //    intervalMs: 3333,
          //});
          
          sf.ui.proTools.waitForNoModals(); 
          
          sf.keyboard.press({
              keys: "ctrl+shift+r",
          });
          
          sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseTitle.is('Preset Toggle').first.elementClick();
          
          sf.keyboard.press({
              keys: "numpad enter",
          });
          
          sf.ui.proTools.audioSuiteOpenPlugin({
              category: "Sound Field",
              name: "Insight 2",
          });
          
          1. Kitch Membery @Kitch2020-10-01 02:50:35.827Z2020-10-01 04:01:33.620Z

            Try this mate :-)

            //Activate Pro Tools main window
            sf.ui.proTools.appActivateMainWindow();
            
            var asWin = sf.ui.proTools.getAudioSuiteWindow("Gain");
            
            //Open Audiosuite "Gain"
            if (!asWin.exists) {
                asWin = sf.ui.proTools.audioSuiteOpenPlugin({
                    category: 'Other',
                    name: "Gain"
                }).window;
            }
            
            //Select Audiosuite Options
            asWin.audioSuiteSetOptions({
                processingInputMode: "ClipByClip",
                processingOutputMode: "CreateIndividualFiles",
            });
            
            //Render and wait for render to complete
            asWin.audioSuiteRender();
            
            //Open Batch Rename...
            sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({
                menuPath: ["Batch Rename..."],
            });
            
            //Wait for Batch Clip Name... Window
            sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.elementWaitFor();
            
            //Click preset 1
            sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseTitle.is('Preset Toggle').first.elementClick();
            
            //Click OK
            sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseTitle.is('OK').first.elementClick();
            
            //Wait for Batch Clip Name... Window to dissapear
            sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.elementWaitFor({waitType:'Disappear'});
            
            sf.ui.proTools.audioSuiteOpenPlugin({
                category: "Sound Field",
                name: "Insight 2",
            });
            
            ReplySolution
            1. Dustin Harris @Dustin_Harris
                2020-10-01 03:46:19.398Z

                On a mobile so I can’t check it, but isn’t there a method for audiosuite plugins at combines render and waitForNoModals? It was something like asWin.audioSuiteRender()?

                1. Kitch Membery @Kitch2020-10-01 04:03:25.539Z

                  Of course... Thanks Dustin I forgot about that :-)

                  I've updated the script.

                  1. Yes - audioSuiteRender is the best way to do this, since it takes into account the potential for very quick processing or even delays in bringing up the progress bar, which waitForNoModals inherently doesn't.

          2. In reply toChipSloan:
            Chris Roberts @Chris_Roberts
              2021-12-04 21:35:47.157Z

              Hi

              I've been playing with some of this script, but have hot a roadblock!

              How do I change the script:

              //Click preset 1
              sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseTitle.is('Preset Toggle').first.elementClick();

              so that I can click other preset buttons .e.g. Preset 4

              Thanks in advance for any help!

              1. Chris Roberts @Chris_Roberts
                  2021-12-04 23:36:07.335Z

                  Apologies, quoting script correctly this time!

                  //Click preset 1
                  sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseTitle.is('Preset Toggle').first.elementClick();
                  
                  1. Hi Chris,

                    Try this:

                    sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseTitle.is('Preset Toggle').allItems[0].elementClick();
                    

                    Switch out the 0 with 1 for the 2nd preset (the array is 0-indexed)

                    1. Chris Roberts @Chris_Roberts
                        2021-12-06 08:13:31.434Z

                        Thanks Christian!