Upon Triggering Macro, Indicate How Many Times You Want Action Repeated?

Is it possible to do this?

Let's say I have a macro that, upon being triggered, performs a series of keystrokes. I typically need this keystroke series performed multiple times, but how many times varies on a case by case basis.

Is it possible to set up a macro so that, after being triggered, I can somehow input or indicate how many times I want the action repeated?

Whatever it is you're trying to do, I'm guessing there are more robust and/or efficient ways of doing it than repeating keystrokes like this, but that said, yes, what you want to do is possible. Use a Prompt for User Input action to enter how many times you want the action(s) to repeat into a variable, then use that variable in a Repeat loop:

Example Macro.kmmacros (2.3 KB)

2 Likes

This works perfectly. Thank you, @gglick!

1 Like

I am looking for a similar option. I have discovered that using a fixed number, say 10, for repetion of a specific macro is not very flexible since I may have to edit the number for each run. (like if I need it to run 45 times, I may let it run 10 times 4, and fix the remainder by single steps).
My question is where in your example would I place the call for my 'external macro' ??
At present I use this very basic option:

kind regards
PalleGT

Hey Palle,

Where the Type a Keystroke action is.

-Chris

My question is not too specific, I guess.
As it is in the example the repeat is set 'permanently' to 29.
prior to running the macro I know from other info on my screen the actual number I want/need the repeat to run.
Instead of editing the macro for every new instance, my present workflow, I am looking for some action built into this macro, whereby I will be asked about a 2 digit input. After that input, say 33, is entered the repeat will then run 33 times.
The constant editing of "Execute these actions..." is cumbersome.

-Palle

Hey Palle,

Have you run Glick's example?

It does exactly what you want. It asks the user for a number and performs that many repetitions on the item(s) in the repeat action.

What else do you want?

-Chris

Am I to understand that Glicks example will substitute the Repeat action I use? I had the impression I would have to merge the two!!!
Not to bright in my head these days, its pollen highseason and besides there was a blackout last night. Remarkable to experience a whole city shut down and out. Has somehow messed with my security settings so why not...
later I'll check the options out with your suggestions
-Palle

1 Like

I had a go at it, but it only takes ONE run!
I inserted pause just to make sure there was time, and I inserted a Sound, to be able to hear 'x' funks
but it just runs once

Not so great Macro.kmmacros (3.4 KB)

That's because you misplaced your actions. Try this one.

-Chris


Repeat Actions a User-Designated Number of Times.kmmacros (3.7 KB)

HEUREKA :nerd_face:
I was too 'square' to even consider the possiblility of dragging one function INTO another one.

now it works :man_dancing:

Thanks for you kind assistance Chris

Palle

2 Likes