Essentially I want to create simple macros to jump to the next track or last track when I'm renaming a lot of tracks at once. Cmd + arrow is a bit clunky for me, I'd rather use Tab and shift + tab. I have the simple code written, but cannot figure out how to ensure it will only run when I am currently renaming tracks (not batch renaming, by the way). Want to save tab to transient as it is a great feature.
sf.keyboard.press({
keys: "cmd+right",
fast: true,
});
- Chad Wahlbrink @Chad2023-12-06 20:19:35.361Z
Hey @Bobby_Knepper !
Currently, keyboard commands for a macro can only be limited by a focused application (only run when Pro Tools is focused, only run when Finder is focused, etc).
Therefore, I would approach this by running a short script that checks for the track name dialog window, and will either click "Next" or "Previous" if that dialog is present, or press the intended keyboard shortcut ("tab" or "shift+tab" in this instance).
Here are the two scripts I would set up with keyboard triggers (one for "tab" / "next" and one for "shift+tab" / "previous").
Script for Moving to Next Track with Tab// This script will click "Next" on the track naming dialog if the dialog window is present, otherwise, it performs "Tab" // This script is meant to be setup with a Keyboard Trigger of Tab when Pro Tools is focused let nameTrackDialogisOpen = sf.ui.proTools.windows.first.children.whoseRole.is("AXStaticText").whoseValue.is("Name the track:").first.exists if (nameTrackDialogisOpen) { sf.ui.proTools.windows.first.buttons.whoseTitle.is("Next").first.elementClick(); } else { sf.keyboard.press({ keys: 'tab' }); }
Script for Moving to Previous Track with Shift+Tab
// This script will click "Previous" on the track naming dialog if the dialog window is present, otherwise, it performs "Shift+Tab" // This script is meant to be setup with a Keyboard Trigger of Shift+Tab when Pro Tools is focused let nameTrackDialogisOpen = sf.ui.proTools.windows.first.children.whoseRole.is("AXStaticText").whoseValue.is("Name the track:").first.exists if (nameTrackDialogisOpen) { sf.ui.proTools.windows.first.buttons.whoseTitle.is("Previous").first.elementClick(); } else { sf.keyboard.press({ keys: "shift+tab", }); }
Also, as a heads up for the future, you can format code on the forum, by wrapping code using three ``` characters. See the guide here:- BBobby Knepper @Bobby_Knepper
Thanks so much man! You're the best!