By Chris Atkins @iamchrisatkins
Hey I have seen a few posts similar to this, but nothing seemed to do what i wanted. I would love to be able to toggle through > Timecode 1 sec > timecode 1 frame and bars|beats 1/4 notes.
- Kitch Membery @Kitch2020-10-16 06:59:28.269Z2020-10-16 07:51:58.410Z
Hi Chris,
Something like this should do it;
const toggleObject = { oneSecond: { time: "1 second", counter: "Timecode" }, oneFrame: { time: "1 frame", counter: "Timecode" }, quarterNote: { time: "1/4 note", counter: "Bars|Beats" } }; function selectMenuItem(selection) { const { time, counter } = selection; const gridValueField = sf.ui.proTools.mainWindow.groups.whoseTitle.is('Grid/Nudge Cluster').first.popupButtons.whoseTitle.is('Grid Value').first; gridValueField.popupMenuSelect({ menuPath: [counter], }); gridValueField.popupMenuSelect({ menuPath: [time], }); } function main() { sf.ui.proTools.appActivateMainWindow(); const readOut = sf.ui.proTools.mainWindow.groups.whoseTitle.is('Grid/Nudge Cluster').first.popupButtons.whoseTitle.is('Grid Value').first.value.invalidate().value; switch (readOut) { case "00:00:01:00.00": selectMenuItem(toggleObject.oneFrame); break; case "00:00:00:01.00": selectMenuItem(toggleObject.quarterNote); break; case "1/4 note": selectMenuItem(toggleObject.oneSecond); break; default: selectMenuItem(toggleObject.oneSecond); } } main();
Mike Cave @Mike_Cave
Hi @Kitch is there a way to modify this script to toggle between Bars/Beats & Mins:secs? (pls see attached pic)
Thanks :)
Mikesamuel henriques @samuel_henriques
hello @Mike_Cave,
Kitch might be busy doing awesome stuff for the next soundFlow update :)
This works for me:
// function to change values function setValue(value) { sf.ui.proTools.mainCounterSetValue({ targetValue: value }) } // get current counter const mainCounter = sf.ui.proTools.getCurrentTimecode().stringValue /// if main counter is Bars Beats change to min secs else chage to Bars Beats mainCounter.match(/\|/i) !== null ? setValue("Min:Secs") : setValue("Bars|Beats")
Kitch Membery @Kitch2021-03-09 21:13:25.054Z
samuel henriques @samuel_henriques
update: missed the mainCounter variable
Mike Cave @Mike_Cave
Awesome!! Thank you so much @samuel_henriques & @Kitch_Membery ....i've been wishing for this for years! :)
Best
Mike