I've made a macro which has a bunch of other macros I made all working together to bounce between markers, move to next marker, make selection and bounce, then repeat. Currently yo "repeat", i've duplicated the steps many times. But some sessions I may have about 100 markers. Is there a way to have the steps once and insert another macro that will keep repeating until there's no more markers? P.S. I've built all this using the Macros tab (I don't know or understand the scripting tab yet).

- Chris Shaw @Chris_Shaw2024-02-19 17:23:22.205Z
Hey @DJAK,
Could you post the code for each of those macros by pressing the "…" button next to each macro and posting the code here like this:- Put a line of three back ticks ```.
- On the next line, add the code / script.
- On the next line after the script add an another 3 back ticks.
Once it's posted it'll be much easier to help you get this workflow working. At the moment there's no way to do this using only macros.
Hi @Chris_Shaw
I hope this is right. Thanks for the help!sf.ui.proTools.memoryLocationsSelectBetween(); //Calling command "Bounce WAV + MP3 Macro" from package "AK's Pro Tools Ninja" sf.soundflow.runCommand({ commandId: 'package:clskpdueu0002de10dbbmsgmt', props: {} }); sf.ui.proTools.waitForNoModals(); //Calling command "Go to Next Marker" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cln0nxiji0000yp102352fxp9") sf.soundflow.runCommand({ commandId: 'user:ckp49i4j60000a2100yfwywgf:ckou1qcq5007mzv10u5biiplz', props: {} });
Line 3 (second action) is calling from another macro I made.
Line 11 (4th/last action) is calling from the "Go to Next Marker" macro.
Kitch Membery @Kitch2024-02-19 22:32:07.285Z
Hi @DJAK,
Here is a video tutorial on how to use a for loop to repeat an action.
A Script like this should do the trick.
const repetitions = 5; for (let i = 0; i < repetitions; i++) { // Select between Memory Locations sf.ui.proTools.memoryLocationsSelectBetween(); //Calling command "Bounce WAV + MP3 Macro" from package "AK's Pro Tools Ninja" sf.soundflow.runCommand({ commandId: 'package:clskpdueu0002de10dbbmsgmt', }); // Wait for modals sf.ui.proTools.waitForNoModals(); //Calling command "Go to Next Marker" from package "Pro Tools" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cln0nxiji0000yp102352fxp9") sf.soundflow.runCommand({ commandId: 'user:ckp49i4j60000a2100yfwywgf:ckou1qcq5007mzv10u5biiplz', }); }
This is perfect @Kitch thank you! I did see this video before but that was before I knew how to get the script codes for the macros that Chris showed me.
I have just one thing i'd like to add if possible. Sometimes my session may have "5" markers to bounce from and sometimes "50". So by default I'm setting the "const repetitions" to 50. But if I have session with 3, it ends like I would expect it to, but it pops up an error. Is there a command I can enter to avoid the error on this script? Or maybe even have my own custom screen pop up saying "Bounce Complete" or something instead of the error? I attached a screenshot of it. Thanks alot!
Kitch Membery @Kitch2024-02-20 00:31:01.552Z
Hi @DJAK,
This is not a technically elegant solution as I'm basing the logic on the failure of the
memoryLocationsGotoDelta
method (I'll report back if I can think of a better implementation), however, it should do the trick for what you are after.const repetitions = 50; sf.ui.proTools.appActivateMainWindow(); repetitionLoop: for (let i = 0; i < repetitions; i++) { // Select between Memory Locations sf.ui.proTools.memoryLocationsSelectBetween(); // Calling command "Bounce WAV + MP3 Macro" from package "AK's Pro Tools Ninja" sf.soundflow.runCommand({ commandId: 'package:clskpdueu0002de10dbbmsgmt', }); // Wait for modals sf.ui.proTools.waitForNoModals(); try { sf.ui.proTools.memoryLocationsGotoDelta({ delta: 1 }); } catch (err) { break repetitionLoop; // This will break out of both the loop and the block } } sf.interaction.displayDialog({ prompt: "Task complete" });