Preset Select in Batch Rename
Hi,
I have the Batch Rename window opening, but I'd like to automatically select a preset (say; SFX) then click ok. I've tried a few ways with Click UI Element/Select Popup with no success. Any ideas? I'm sure its easy but not a newbie....
Here's the code so far;
sf.ui.proTools.appActivateMainWindow();
sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
isRightClick: true,
menuPath: ['Batch Rename...']
});
Linked from:
Raphael Sepulveda @raphaelsepulveda2021-04-01 19:51:48.621ZHey Geoff!
Here you go!
/** @param {string} presetMenuPath */ function batchTrackRenameWithPreset(presetMenuPath) { // Identify Batch Track Rename window const batchTrackRenameWin = sf.ui.proTools.windows.whoseTitle.is("Batch Track Rename").first; // Launch Batch Track Rename sf.keyboard.press({ keys: "alt+shift+r" }); // Wait for Batch Track Rename to appear batchTrackRenameWin.elementWaitFor(); // Select preset batchTrackRenameWin.children.whoseRole.is("AXMenuButton").whoseTitle.is("Librarian menu").first.popupMenuSelect({ menuPath: [presetMenuPath], }); // Click "OK" and wait for window to close batchTrackRenameWin.buttons.whoseTitle.is("OK").first.elementClick(); batchTrackRenameWin.elementWaitFor({ waitForNoElement: true }); } batchTrackRenameWithPreset('<factory default>');Just add the preset name to the last line. Following your SFX example, it would look like:
batchTrackRenameWithPreset('SFX');
Geoff McGarvey @Geoff_McGarveyHi Raphael,
Thanks so much for taking the time and effort to write this code (and the helpful how to comments!). I really appreciate your kindness. I’ll be back in the studio on Tuesday and give it a run. Thanks again and all the best to you!
Geoff
Raphael Sepulveda @raphaelsepulveda2021-04-02 15:58:34.253ZNo problem! Let me know if you need help with anything else!
In reply toGeoff_McGarvey⬆:Geoff McGarvey @Geoff_McGarveyHi Raphael,
Thanks again for the code. It isn't quite working though. I'm getting this;
So it brings up the Batch Rename window but faults there. Here's the window (I selected 'SFX')
I've tried with another preset name but with the same outcome. Factory Default just comes up with 'new names same as old' as its not chnaging anything. I'd appreciate your help with this one, but if you're busy, no issue.
Thanks again,
Geoff
Raphael Sepulveda @raphaelsepulveda2021-04-06 00:55:56.950ZOh no! Okay, I think I see the issue. The error says it couldn't find the menu item with the name
<SFX>, but the preset on the screenshot reads SFX (without the <>). Can you double-check that you typed it in correctly? It should look like this:
batchTrackRenameWithPreset('SFX');
Geoff McGarvey @Geoff_McGarveyYou are the best! Problem solved!! Sorry I figured , <&> were a code thing but of course they're just in the default name.
Thanks so much Raphael.