How to Randomly Select and Type One Item from a List in Keyboard Maestro

Hi everyone,

I'm trying to create a macro in Keyboard Maestro that will randomly select one name from a list and type it. I already have multiple Insert Text by Typing actions, each containing a different name. My goal is for the macro to pick one random name and type it each time it's triggered.

I've tried different approaches, but I want to do it without using JavaScript or AppleScript—just using built-in Keyboard Maestro actions.
i have list of names inside separate Insert Text by Typing actions:
please i want When I trigger the macro, only one random name from the list should be typed.

This has come up a few times here, including fairly recently:

There are some good solutions there using Keyboard Maestro's arrays with custom delimiters that should work for you.

-rob.

here
this is what i try until now
please an you share with me
the macro that suit for my needs
please

יעול הכנסת הביקורות באתר שלי.kmmacros (7.9 KB)

I have a macro that requires a random selection for which I use switch/case because there are only around eight cases, so I was curious if there was a general solution for what appears to be a rather longish list of words. I still have regex on the brain and thus came up with this. Words can be added and removed from the list without affecting the macro. Perhaps not the most elegant solution, but surprisingly straightforward.

Here's a "shorter" solution.

You can replace "Display Text Large" with "Insert Text by Typing."

3 Likes

Y'er a wizard, @Airy

(Fifteen hours it took my brain to think of this joke/reference)

I never saw the movie so I had to google your compliment and it popped up quickly. Thanks.

Sorry about the final 10 seconds of this video which seem irrelevant.

1 Like

my friend can you share the macro that i could download your macro and put directly on my keyboard maestro
and maybe change something

I strongly encourage you to use @Airy's solution. It's much better than mine and only two actions, very easy to replicate.