Transport Control on Pro Tools
Hi everyone,
I've been looking for a way to move precisely the playhead of Pro Tools with soundflow.
I have tried macro / script to set a text value in the text field of the Main Counter:
sf.ui.proTools.mainWindow.groups.whoseTitle.is("Counter Display Cluster").first.textFields.whoseTitle.is("Main Counter").first.elementSetTextFieldWithAreaValue({
value: "10:00.000",
});
But this doesn't work:
11.02.2022 10:50:04.71 <info> [Backend]: !! Command Error: Macro1 [user:ckzfcz12w00001i10xq76fhdd:ckzi8a8bs000g1i10yhq161ri]:
Could not set text area value (Macro1: Line 2)
And after checking the elements with the accessibility API, this "AXTextField" is not settable.
Does anyone have a script or know a way to move the playhead to a precise position with soundflow ?
That would be of great help, and if it is not possible, it is good to know also.
Thank you very much in advance,
Best
Maxime
- MMax Bobo @Max_Bobo
Hey back,
I found how to do this, by clicking the element and entering a text:
//Activate Pro Tools Main Window sf.ui.proTools.appActivateMainWindow(); //Click on New Meter's first field. sf.ui.proTools.mainWindow.groups.whoseTitle.is("Counter Display Cluster").first.textFields.whoseTitle.is("Main Counter").first.elementClick(); //Type text sf.keyboard.type({ text: "999", });
My question is, how to format the text for it to actually work, because at the moment it just writes some dummy 999 at the end of the "Min:Secs" timestamp ?
I'm thinking of maybe simulating a enter key at the end for the playhead to move..
Thx
Maxime - In reply toMax_Bobo⬆:Raphael Sepulveda @raphaelsepulveda2022-02-11 22:36:06.866Z
@Max_Bobo Ah yes, these types of text fields are a bit tricky.
Here's one way to set the Main Counter to a specific value in Min:Secs:
/** @param {{ newValue: string }} arg - "00:00.000" format */ function setMainCounterMinSecs({ newValue }) { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainCounterDoWithValue({ targetValue: "Min:Secs", action: () => { const values = newValue.match(/^(\d+):(\d+).(\d+)$/); if (!values) throw 'Please enter Main Counter New Value in "00:00.000" format'; const mainCounter = sf.ui.proTools.mainWindow.counterDisplay.textFields.whoseTitle.is("Main Counter").first; mainCounter.elementClick(); values.reverse().forEach((value, i, arr) => { if (i === arr.length - 1) return; sf.keyboard.press({ keys: "left" }); sf.keyboard.type({ text: value }); }); sf.keyboard.press({ keys: "return" }); } }); } setMainCounterMinSecs({ newValue: "10:00.000" });
- AAndreas Altmann @Andreas_Altmann
Great! Is there a way to make it that I can enter the specific time or bar?
Thanks a bunch!Raphael Sepulveda @raphaelsepulveda2023-02-07 04:24:30.733Z
@Andreas_Altmann, here it is for Bars|Beats:
// /** @param {{ newValue: string }} arg - "1|1|000" format */ function setMainCounterBarsBeats({ newValue }) { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainCounterDoWithValue({ targetValue: "Bars|Beats", action: () => { const mainCounter = sf.ui.proTools.mainWindow .counterDisplay.textFields.whoseTitle.is("Main Counter").first; const values = newValue.match(/^(\d+)\|(\d)\|(\d+)$/); if (!values) throw 'Please enter Main Counter New Value in "1|1|000" format'; mainCounter.elementClick(); values.slice(1).reverse().forEach((value) => { sf.keyboard.press({ keys: "left" }); sf.keyboard.type({ text: value }); }); sf.keyboard.press({ keys: "return" }); } }); } setMainCounterBarsBeats({ newValue: "5|1|000" // Enter value here });
- AIn reply toMax_Bobo⬆:Andreas Altmann @Andreas_Altmann
Sorry, I'm looking for it to run like this: I press a stream deck button and I enter the time or bar number. I can change the scribt for the bar/time option, but I have problems writing script for the flexibility of entering the bar/time.
Example: My clients usually give me mixing notes with Min:Sec so I'd like to enter that manually.
I apologize and should have been more clearer...
ThanksChris Shaw @Chris_Shaw2023-02-07 18:02:54.836Z
You should get the Scheps Offset counter in the store. It's made for exactly what you are trying to do
https://soundflow.org/store/pkg/counter-offset