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

Batch Clip Rename Using Saved Presets

By yianniap @yianniap
    2023-06-30 19:02:08.243Z

    Title

    Batch Clip Rename Using Saved Presets

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

    Hi there!

    I'm trying to make a macro that will help me batch rename clips using a batch rename preset that I have saved in the batch clip rename window.

    I'm having a hard timing figuring out how to do it though.

    I want to be able to select all my drum stums and have the macro select the entire clip, open the batch clip rename window, select my preset for how I like my drum stems labeled, and hit OK.

    I want to have a macro for each of my stem groups, each one ysing a different batch clip rename preset... ie bass, drums, keys, guitars, etc.

    Help!!

    Are you seeing an error?

    I'm not so much getting an error as I am just unsure how to set it up. I'm stuck

    What happens when you run this script?

    I'm stuck at the step of opening the batch clip rename window. I'm not sure what action should be used to get that window to open

    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": "Hi there!\n\nI'm trying to make a macro that will help me batch rename clips using a batch rename preset that I have saved in the batch clip rename window.\n\nI'm having a hard timing figuring out how to do it though.\n\nI want to be able to select all my drum stums and have the macro select the entire clip, open the batch clip rename window, select my preset for how I like my drum stems labeled, and hit OK. \n\nI want to have a macro for each of my stem groups, each one ysing a different batch clip rename preset... ie bass, drums, keys, guitars, etc.\n\nHelp!!\n",
        "inputIsError": true,
        "inputError": "I'm not so much getting an error as I am just unsure how to set it up. I'm stuck",
        "inputWhatHappens": "I'm stuck at the step of opening the batch clip rename window. I'm not sure what action should be used to get that window to open",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 5,
        "inputTitle": "Batch Clip Rename Using Saved Presets"
    }

    Source

    //Macro converted to script
    
    
    sf.ui.proTools.menuClick({
        menuPath: ["Edit","Select All"],
    });
    
    sf.ui.proTools.menuClick({
        menuPath: ["View","Other Displays","Clip List"],
    });
    
    sf.ui.proTools.mainWindow.popupButtons.first.elementClick();
    
    sf.wait();
    
    sf.keyboard.press({
        keys: "down, down, down, down, down, down, down",
    });
    
    
    

    Links

    User UID: V1j0aAqXguStBYYHVLNaRpbeV4V2

    Feedback Key: sffeedback:V1j0aAqXguStBYYHVLNaRpbeV4V2:-NZCfm04tt5jolasJDWN

    Feedback ZIP

    • 1 replies
    1. @yianniap, give this a shot.

      Make sure to change Line 29 with the menu path to your preset—if there are no folders in the preset menu then it would just be the name of the preset like I put in the example.

      /** @param {{ presetMenuPath: string[] }} args */
      function batchClipRenameWithPreset({ presetMenuPath }) {
          const batchClipRenameWin = sf.ui.proTools.windows.whoseTitle.is("Batch Clip Rename").first;
          const presetPopupMenu = batchClipRenameWin.children.whoseRole.is("AXMenuButton").whoseTitle.is("Librarian menu").first;
      
          sf.ui.proTools.appActivateMainWindow();
      
          // Open Batch Clip Rename
          sf.keyboard.press({
              keys: "ctrl+shift+r",
          });
      
          batchClipRenameWin.elementWaitFor();
      
          // Select preset
          presetPopupMenu.popupMenuSelect({
              menuPath: presetMenuPath
          });
      
          batchClipRenameWin.buttons.whoseTitle.is("OK").first.elementClick();
          batchClipRenameWin.elementWaitFor({ waitType: "Disappear" });
      }
      
      sf.ui.proTools.menuClick({
          menuPath: ["Edit","Select All"],
      });
      
      batchClipRenameWithPreset({
          presetMenuPath: ["Drums"] // Change this to the menu path of your preset
      });