VCA group assignment not working
Hi there,
I have a script that does a variety of things including creating and assigning a VCA to a group called Drums. I got it to work for some time but now it stopped. Any help would be appreciated:
sf.keyboard.press({
keys: "cmd+g",
});
sf.wait({
intervalMs: 200,
});
sf.keyboard.type({
text: "Drums",
});
sf.wait({
intervalMs: 200,
});
sf.keyboard.press({
keys: "numpad enter",
});
sf.ui.proTools.selectedTrack.trackOutputSelect({
outputPath: ["new track..."],
selectForAllSelectedTracks: true,
});
sf.wait({
intervalMs: 200,
});
sf.keyboard.type({
text: "Drums",
});
sf.keyboard.press({
keys: "numpad enter",
});
sf.ui.proTools.colorsSelect({
colorBrightness: "Medium",
colorNumber: 21,
});
sf.wait({
intervalMs: 750,
});
sf.keyboard.press({
keys: "cmd+shift+n",
});
sf.keyboard.press({
keys: "cmd+right, cmd+down, cmd+down, cmd+down, tab",
});
sf.keyboard.type({
text: "Drums VCA",
});
sf.keyboard.press({
keys: "numpad enter",
});
sf.wait({
intervalMs: 200,
});
sf.ui.proTools.colorsSelect({
colorBrightness: "Medium",
colorNumber: 21,
});
sf.wait({
intervalMs: 250,
});
sf.ui.proTools.selectedTrack.groups.whoseTitle.is('VCA IO').first.buttons.whoseTitle.startsWith('Group Assignment selector').first.popupMenuSelect({
menuPath: ['*- Drums'],
useWildcards: true
});
- Kitch Membery @Kitch2025-03-04 18:03:44.247Z
Hi @Joel_Krozer
In point form, can you list the manual steps that you'd take to achieve this workflow?
Please note that using Keyboard and Mouse simulation is the least robust way to create scripts and macros in SoundFlow. However, with an understanding of what you're trying to achieve, much of the Keyboard and Mouse simulation could possibly be converted into UI automation.
You're also using arbitrary fixed-length waits, where you may be able to wait for a specific outcome instead, making the scripts more stable.
Thanks in advance. :-)
- In reply toJoel_Krozer⬆:Kitch Membery @Kitch2025-03-05 00:04:01.038Z
Hi @Joel_Krozer,
Taking a closer look at your script, I worked out what you were trying to achieve.
Here is a script that should be way more robust, replacing keyboard simulation with UI Automation and arbitrary waits, with the
elementWaitFor()
method.function createGroup({ name }) { // Create a track group sf.ui.proTools.menuClick({ menuPath: ["Track", "Group..."] }); // Reference the "Create Group" dialog window const createGroupDialog = sf.ui.proTools.createGroupDialog; const nameField = createGroupDialog.textFields.first; const okButton = createGroupDialog.buttons.whoseTitle.is("OK").first; // Wait for the "Create Group" dialog to appear createGroupDialog.elementWaitFor(); // Set the group name nameField.elementSetTextFieldWithAreaValue({ value: name }); // Confirm by clicking OK okButton.elementClick(); // Wait for the "Create Group" window to disappear createGroupDialog.elementWaitFor({ waitType: "Disappear" }); } function selectTrackOutput({ trackName }) { // Ensure the selected track is in view sf.ui.proTools.selectedTrack.trackScrollToView(); // Select "new track..." for all selected tracks sf.ui.proTools.selectedTrack.trackOutputSelect({ outputPath: ["new track..."], selectForAllSelectedTracks: true, }); // Reference the "New Track" window const newTrackWindow = sf.ui.proTools.windows.whoseTitle.is("New Track").first; const trackNameField = newTrackWindow.textFields.whoseTitle.is("Track name").first; const createButton = newTrackWindow.buttons.whoseTitle.is("Create").first; // Wait for the "New Track" window to appear newTrackWindow.elementWaitFor(); // Set the track name trackNameField.elementSetTextFieldWithAreaValue({ value: trackName }); // Click the "Create" button createButton.elementClick(); // Wait for the "New Track" window to disappear (Fixed spelling) newTrackWindow.elementWaitFor({ waitType: "Disappear" }); } function createVCATrack({ vcaName }) { // Open the "New Track" menu sf.ui.proTools.menuClick({ menuPath: ["Track", "New..."] }); // Reference the "New Tracks" window const newTracksWindow = sf.ui.proTools.windows.whoseTitle.is("New Tracks").first; const trackTypePopup = newTracksWindow.popupButtons.whoseDescription.is("Track type").first; const trackNameTextField = newTracksWindow.textFields.whoseTitle.is("Track Name").first; const createButton = newTracksWindow.buttons.whoseTitle.is("Create").first; // Wait for the "New Tracks" window to appear newTracksWindow.elementWaitFor(); // Select "VCA Master" as the track type trackTypePopup.popupMenuSelect({ menuPath: ["VCA Master"] }); // Set the VCA track name trackNameTextField.elementSetTextFieldWithAreaValue({ value: vcaName }); // Click the "Create" button createButton.elementClick(); // Wait for the "New Tracks" window to disappear newTracksWindow.elementWaitFor({ waitType: "Disappear" }); } function main() { // Activate and invalidate Pro Tools main window sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); // Create a track group named "Drums" createGroup({ name: "Drums" }); // Set track output to a new track named "Drums" selectTrackOutput({ trackName: "Drums" }); // Assign color to the track sf.ui.proTools.colorsSelect({ colorBrightness: "Medium", colorNumber: 21, }); // Create a VCA track named "Drums VCA" createVCATrack({ vcaName: "Drums VCA" }); // Since a new track has been added, invalidate the main window sf.ui.proTools.mainWindow.invalidate(); // Set the VCA track color sf.ui.proTools.colorsSelect({ colorBrightness: "Medium", colorNumber: 21, }); // Refocus the main window sf.ui.proTools.appActivateMainWindow(); // Reference the selected track and its group assignment controls const selectedTrack = sf.ui.proTools.selectedTrack; const vcaIoButtons = selectedTrack.groups.whoseTitle.is("VCA IO").first.buttons; const groupAssignmentSelectorPopup = vcaIoButtons.whoseTitle.startsWith("Group Assignment selector").first; // Ensure the selected track is in view sf.ui.proTools.selectedTrack.trackScrollToView(); // Assign the VCA track to the "Drums" group groupAssignmentSelectorPopup.popupMenuSelect({ menuPath: ["*- Drums"], useWildcards: true, }); } main();
I hope that helps! :-)
- JJoel Krozer @Joel_Krozer
Wow thank you so much for this. I can’t wait to test this in the studio today.
Yes, my method is still a bit crude, I’ll try to learn from your revisions and apply it to upcoming scripts.
- JIn reply toJoel_Krozer⬆:Joel Krozer @Joel_Krozer
It works beautifully, thanks again. I have now replicated this script for all other stems. Q: How do I make the bus I create mono? (something I always do for the lead vocal stem). Is there a line I can add somewhere that will do this?