Ammending Auto BD workflow
Title
Ammending Auto BD workflow
What do you expect to happen when you run the script/macro?
Failing on r.childrenByRole("AXCell").first.buttons.first.elementClick();
Are you seeing an error?
18.01.2023 15:41:13.01 [Backend]: Logging error in action (01) ClickButtonAction: Error invoking AXElement: kAXErrorCannotComplete
18.01.2023 15:41:13.01 [Backend]: !! Command Error: Auto Beat Detective 16 [user:default:clctqt5z8000qnv10403ety04]:
Error invoking AXElement: kAXErrorCannotComplete (Auto Beat Detective 16: Line 36)
SoundFlow.Shortcuts.AXUIElementException: kAXErrorCannotComplete
at SoundFlow.Shortcuts.AXUIElement.DoAction(String) + 0xb7
at SoundFlow.Shortcuts.Automation.Actions.ClickButtonAction.d__11.MoveNext() + 0x82
What happens when you run this script?
Script opens BD window, then group window and bombs out
How were you running this script?
I used a Stream Deck button
How important is this issue to you?
3
Details
{ "inputExpected": "Failing on r.childrenByRole(\"AXCell\").first.buttons.first.elementClick();\n", "inputIsError": true, "inputError": "18.01.2023 15:41:13.01 [Backend]: Logging error in action (01) ClickButtonAction: Error invoking AXElement: kAXErrorCannotComplete\n\n18.01.2023 15:41:13.01 [Backend]: !! Command Error: Auto Beat Detective 16 [user:default:clctqt5z8000qnv10403ety04]:\nError invoking AXElement: kAXErrorCannotComplete (Auto Beat Detective 16: Line 36)\n SoundFlow.Shortcuts.AXUIElementException: kAXErrorCannotComplete\n at SoundFlow.Shortcuts.AXUIElement.DoAction(String) + 0xb7\n at SoundFlow.Shortcuts.Automation.Actions.ClickButtonAction.d__11.MoveNext() + 0x82\n", "inputWhatHappens": "Script opens BD window, then group window and bombs out", "inputHowRun": { "key": "-MpfwmPg-2Sb-HxHQAff", "title": "I used a Stream Deck button" }, "inputImportance": 3, "inputTitle": "Ammending Auto BD workflow\n" }
Source
const beatDetectiveSettings = {
selectionContains: "1/16 Note",
sensitivity: '21',
triggerPad: '10',
crossfadeLength: '7',
drumGroupName: "Drums",
};
/**
* @param {AxElement} window
* @param {AxElement} field
* @param {string} num
*/
function setNumericEntryTextField(window, field, num) {
window.elementRaise();
field.elementClick();
sf.keyboard.type({ text: num });
var i = 0;
while (field.value.invalidate().value !== num) {
sf.wait({ intervalMs: 50 });
};
sf.keyboard.press({ keys: 'return' });
}
/**
* @param {string} groupName
*/
function selectAllTracksInGroup(groupName) {
sf.ui.proTools.mainWindow.groupListView.childrenByRole("AXRow").filter(r => {
r.childrenByRole("AXCell").allItems[1].buttons.first.title.value.split(/-\s/)[1] === groupName &&
r.childrenByRole("AXCell").first.buttons.first.title.invalidate().value === 'Selected. , Track selection partially contains group'
r.childrenByRole("AXCell").first.buttons.first.elementClick();
});
}
function doBeatDetective(settings) {
//Deconstruct Beat Detective Settings
const { selectionContains, sensitivity, triggerPad, crossfadeLength, drumGroupName, } = settings;
//Activate Pro Tools main window
sf.ui.proTools.appActivateMainWindow();
//Get originally selected tracks
const originalTracks = sf.ui.proTools.selectedTrackNames;
//Delete Fades
sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Fades', 'Delete'] });
//Variable for Beat Detective window
const beatDetectiveWindow = sf.ui.proTools.windows.whoseTitle.is('Beat Detective').first;
//Open Beat Detective
if (!beatDetectiveWindow.exists) {
sf.ui.proTools.menuClick({
menuPath: ["Event", "Beat Detective"],
targetValue: 'Enable'
});
}
//Wait for Beat Detective Window.
beatDetectiveWindow.elementWaitFor();
//Variables for Beat Detective pannels.
const operationPanel = beatDetectiveWindow.groups.whoseTitle.is('Operation').first;
const selectionPanel = beatDetectiveWindow.groups.whoseTitle.is('Selection').first;
const detectionPanel = beatDetectiveWindow.groups.whoseTitle.is('Detection:').first;
const smoothingPanel = beatDetectiveWindow.groups.whoseTitle.is('Smoothing:').first;
//Enable "Clip Separation"
operationPanel.radioButtons.whoseTitle.is('Clip Separation').first.checkboxSet({
targetValue: "Enable",
});
//Set "Selection Contains:" to 1/16 Note
selectionPanel.popupButtons.first.popupMenuSelect({
menuPath: [selectionContains],
});
//Capture Selection
selectionPanel.buttons.whoseTitle.is('Capture Selection').first.elementClick();
//Analyze Selection
detectionPanel.buttons.whoseTitle.is('Analyze').first.elementClick();
//Variable for "Sensitivity" field
const sensitivityNumberField = detectionPanel.textFields.whoseTitle.is('NumericEntryText').first;
//Set "Sensitivity" field
setNumericEntryTextField(beatDetectiveWindow, sensitivityNumberField, sensitivity);
//Variable for "Trigger pad" field
const triggerPadNumberField = detectionPanel.textFields.whoseTitle.is('NumericEntryText').allItems[1];
//Set "Trigger pad" field
setNumericEntryTextField(beatDetectiveWindow, triggerPadNumberField, triggerPad);
//Activate Drum Group
selectAllTracksInGroup(drumGroupName);
//Activate "Drum Group"
sf.ui.proTools.groupsActivateOnly({
groupName: drumGroupName,
});
//Seperate
beatDetectiveWindow.buttons.whoseTitle.is('Separate').first.elementClick();
//Clip Conform
operationPanel.radioButtons.whoseTitle.is('Clip Conform').first.checkboxSet();
//Conform
beatDetectiveWindow.buttons.whoseTitle.is('Conform').first.elementClick();
//Edit Smoothing
operationPanel.radioButtons.whoseTitle.is('Edit Smoothing').first.checkboxSet();
//Fill and Crossfade
smoothingPanel.radioButtons.whoseTitle.is('Fill And Crossfade').first.checkboxSet();
//Variable for "Crossfade Length" field
const crossfadeLengthNumberField = smoothingPanel.textFields.whoseTitle.is('NumericEntryText').first;
//Set "Crossfade Length" field
setNumericEntryTextField(beatDetectiveWindow, crossfadeLengthNumberField, crossfadeLength);
//Smooth
beatDetectiveWindow.buttons.whoseTitle.is('Smooth').first.elementClick();
//Reselect original tracks
sf.ui.proTools.trackSelectByName({ names: originalTracks });
//Solo Drums
sf.ui.proTools.selectedTrack.trackSetSolo({
targetValue: "Enable",
});
beatDetectiveWindow.getElement('AXCloseButton').elementClick();
}
doBeatDetective(beatDetectiveSettings);
Links
User UID: Wqi34WBIhPeNRlE4ChkuoJytywb2
Feedback Key: sffeedback:Wqi34WBIhPeNRlE4ChkuoJytywb2:-NM4XxsqFW-gIb394_UB