No internet connection
  1. Home
  2. How to

Do for each selected clip

By Pete Watson @Pete_Watson
    2022-02-09 12:58:22.836Z2022-02-09 13:24:52.982Z

    Hi, I have a macro that has been working fine, and now has stopped working properly! Not sure if it's something that changed with v5 of Soundflow, or if I have a setting in Protools that is tripping it up. It does however, sometimes still work, and I can't figure out what the difference is.

    I do a lot of projects with multiple clips that need exporting (individual songs from a live gig). I create a black audio track at the top, then for each export range I create a blank clip group on that track, and name it with the song title. The macro I have lets me select all these clips (10 or so), and with a key stroke, it takes the name from each clip group and exports that range one after the other.

    I realise that in this code I'm using keystrokes which isn't the best, but I'm not advanced enough yet to get to the bottom of clicking the drop down menus etc, so it's a halfway house.

    It will currently bounce the first clip successfully, then when it goes to select the 2nd clip it extends the range selection to include both the first and section clip, them gives the error "could not go to next clip through counter selection (Print With clip Name Line 33)

    I noticed at the start of running the macro it switches the main counter to samples (I normally have it on Beats). I don't remember the macro doing that when it was working fine on v4 of Soundflow so not sure if that is a clue... maybe it did and I didn't notice!

    
    //Ensure Link Timeline and Edit Selection is ON
    var wasLinked = sf.ui.proTools.getMenuItem('Options', 'Link Timeline and Edit Selection').isMenuChecked;
    if (!wasLinked) {
        sf.ui.proTools.menuClick({
            menuPath: ["Options", "Link Timeline and Edit Selection"],
        });
    }
    
    function PrintClip() {
    sf.ui.proTools.menuClick({
        menuPath: ["Clip","Rename..."],
    });
    
    sf.keyboard.press({
        keys: "cmd+c, return",
    });
    
    sf.ui.proTools.menuClick({
        menuPath: ["File","Bounce Mix..."],
    });
    
    sf.keyboard.press({
        keys: "cmd+v",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first.buttons.whoseTitle.is("Bounce").first.elementClick();
    
    }
    
     sf.ui.proTools.clipDoForEachSelectedClip({
            action: PrintClip,
    
        });
    
    //Restore Link Track and Edit selection
    if (!wasLinked) {
        sf.ui.proTools.menuClick({
            menuPath: ["Options", "Link Timeline and Edit Selection"],
        });
    }
    
    • 2 replies
    1. P
      Pete Watson @Pete_Watson
        2022-02-09 14:48:41.233Z

        Ok so adding in:

        sf.wait({intervalMs: 500});
        
        sf.ui.proTools.waitForNoModals();
        

        After the hitting the final Bounce button seems to have fixed it - guess it was just running to fast? But weird it's sometimes fine and then not at other times

        Let me know if anyone sees any other potential issues! Thanks

        1. In reply toPete_Watson:

          looks good.
          To get rid of the the key presses I would replace

          sf.keyboard.press({
              keys: "cmd+c, return",
          });
          
          sf.ui.proTools.menuClick({
              menuPath: ["File","Bounce Mix..."],
          });
          
          sf.keyboard.press({
              keys: "cmd+v",
          });
          

          wIth

          sf.ui.proTools.menuClick({
              menuPath: ["Edit", "Copy"],
          });
          
          sf.ui.proTools.windows.whoseTitle.is("Name").first.buttons.whoseTitle.is("OK").first.elementClick();
          
          sf.ui.proTools.menuClick({
              menuPath: ["File","Bounce Mix..."],
          });
          
          
          sf.ui.proTools.menuClick({
              menuPath: ["Edit", "Paste"],
          });
          

          This should make the script more stable.