Hi,
I was trying to replicate the behavior of "The Guardian Angel for Pro Tools".
Using the Eucon commands on my artist control I still depend on this safety net.
I know that with SoundFlow commands this is a non-issue.
I figured out it should be a runForever Script.
And that it should look ("wait") for the confirmation dialogue to appear.
And only if the text contains "length of selection" would confirm the dialogue.
Is first.elementWairFor
the right way?
This is what I've got, but it does nothing:
function main() {
try {
if (sf.ui.proTools.confirmationDialog.children.whoseRole.is("AXStaticText").whoseValue.contains('length of the selection').first.elementWaitFor({
pollingInterval: 300,
timeout: 3000,
})) {
sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('OK').first.elementClick();
}
function runForever(guardianAngel, action, interval, timeout) {
var now = (new Date).valueOf();
if (now - globalState[guardianAngel] < timeout) throw 0; //Exit if we were invoked again inside the timeout
globalState[guardianAngel] = now;
sf.engine.runInBackground(function () {
try {
while (true) {
sf.engine.checkForCancellation();
globalState[guardianAngel] = (new Date).valueOf();
action();
sf.wait({ intervalMs: interval, executionMode: 'Background' });
}
} finally {
globalState[guardianAngel] = null;
}
});
}
runForever("guardianAngel", main, 500, 5000);
- Christian Scheuer @chrscheuer2020-11-11 17:10:47.370Z
Hi Jascha
There's no need to replicate Guardian Angel in SoundFlow, since SoundFlow already has built-in support for writing automation in a safe way.
See more here:
- JJascha Viehl @Jascha_Viehl
Hi Christian,
I know (searched for it here of course) but I'm using (and want to use) SoundFlow on a Stream Deck XL mostly for editing commands and AudioSuites. Things that I cannot do on the Artist Control.
My automation commands, (Preview, Write to Selection, Suspend Preview, Trim...) are on softkeys on my Artist Control and therefore triggered via Eucon.
I would like to use the perfectly fine softkeys on the Artist Control for that. And still have the guardian functionality.Christian Scheuer @chrscheuer2020-11-11 18:14:46.161Z
Ok. Can you set up your softkey to trigger a keyboard shortcut instead?
I'm asking since you'd get a much more stable and CPU-friendly solution this way rather than trying to have a runForever script do it for you.
We generally advise against using runForever scripts unless absolutely necessary for the implementation.- JJascha Viehl @Jascha_Viehl
I think the keypress would not work, since it doesn't readout which confirmation dialog to suppress (press enter) and which not.
This is one of the cases where I would say the runForever script is absolutely necessary. :)
Isn't Guardian Angel itself a runForver script in AppleScript?
Christian Scheuer @chrscheuer2020-11-11 18:42:14.149Z
Hi Jascha,
SoundFlow takes care of knowing which confirmation dialogs to cancel or not. As I mentioned, this workflow is fully supported in SoundFlow.
The easiest way to get access to that, instead of starting from scratch and writing your own, is to just have your softkey simulate a keypress that uses the built-in SoundFlow commands "Write Automation to Selection (+ Confirmation Dialog)". That command already ensures that only safe writes will dismiss the warning dialog, and unsafe writes (to the whole session) will let the dialog stay open to allow you to know you should undo.
Christian Scheuer @chrscheuer2020-11-11 18:46:52.781Z
So in other words, you'd set up a keyboard trigger on this command in the SoundFlow -> Pro Tools -> Automation Window folder:
Now you can always access this from your keyboard. It takes care of knowing to automatically close the warning popup if you did a safe write - and keeps it open if it was unsafe.
Since you prefer running this from your Artist Control, set up your Artist Control to simulate the keypress that you used for the keyboard trigger. That way, your Artist Control gets direct access to the SoundFlow command, and it should work directly.
- JJascha Viehl @Jascha_Viehl
Now I got it. :)
Only disadvantage: I take my continuously developing EuCon user set with me to mixing studios, which might not all have SoundFlow.
Then I need to change this EuCon sofkey in preparation.I set it up and it works really great and fast.