Is there a way to indicate the number of repetitions for a specific macro?

Let's say I set up a macro with a set of 6 (different key strokes that happen one after the other), is there a way to insert an action at the very end that tells BTT to repeat this macro "x" amount of times? Does something like this exist?

The easiest would be to create a "named trigger" and assign the actions to that. Then assign the "Run Real Java Script" action to execute that named trigger multiple times:

(async ()=> {
    await callBTT('trigger_named', {trigger_name: 'your_trigger_name'});
    await callBTT('trigger_named', {trigger_name: 'your_trigger_name'});
    await callBTT('trigger_named', {trigger_name: 'your_trigger_name'});
    await callBTT('trigger_named', {trigger_name: 'your_trigger_name'});
    await callBTT('trigger_named', {trigger_name: 'your_trigger_name'});
    returnToBTT("");
})();

Of course you can also use a for loop here:

(async ()=> {
    for(var x=0; x<10; x++)  {
       await callBTT('trigger_named', {trigger_name: 'your_trigger_name'});
    }
    returnToBTT("");
})();

Here is a more detailed example on how to use the "Run Real Java Script" action:

1 Like

Thanks so much Andreas, I'm going to have to read through everything and try and work it out!

Ok, I tried doing this but I guess I'm missing something... I've attached screenshots which show exactly how I set things up. Hopefully you can point me in the right direction because I'm obviously doing something wrong somewhere...

Ok I've managed to get it to work in a different way, turns out I wasn't using the correct Action, needed to use "Trigger Named Trigger" instead... then I simply created multiples of the same Action as you'll notice from my screenshot :joy:

Everything is working now the way I wanted it to but I'd still like to know how to get it to work with the Javascript code you mentioned. Also, what I would actually really prefer is a pop up box that pops up and asks me to type in the number of repetitions before executing the actions, since sometimes I would like it to repeat 4 times, sometimes 5 times, etc... this varies depending on the project I'm working on. Any way to do this?

EDIT: Just tested this Named Trigger thing on a few different projects, it seems like some of the key strokes in the Named Trigger are sometimes "skipped over" and I'm not exactly sure why?

Any help?