Random words generator

I'm using this audio app/plugin that has a really interesting feature that I've never seen in any other plugin/app: when I'm about to save a new preset, they included a randomize button and it automatically creates a random name, most of the times by using 2 words. Pretty neat!

Is there a way to create a macro that would be able to recreate this? My goal is to always have 2 words, the first one being for example an adjective and the second one a noun. Then I would be able to click a button to refresh and generate a new one. Then a button to copy it to the clipboard

I know this is probably too advanced and maybe not even possible with KM, but decided to ask anyway.

I'm using Raycast as well and they have an extension with a lot of different options, one of them is Song Name, which is similar, but they use known song names and that's not the perfect solution.

I know that I can find online stuff, but I was trying to have something that's quick to access without relying on online services, which takes more time.

I found this website and it kinda does some of the job, but still not what I'm looking for, because it generates really random words and I probably wouldn't use at all:
https://www.cryan.com/daily/20180522.jsp

Maybe it can be useful? I have no idea, because I know "zero" about shell scripts...

I just found another thread here on the forum, but I don't know if this is also helpful?
This seems to be more advanced stuff:

And here's exactly what I would like to achieve, but this is online:
https://www.michaelfogleman.com/phrases/

Yes.

My approach would be to have two KM variables - one called, say, adjective and the other noun and you’d fill them both with a list of the appropriate type of word.

Next, you’d use the RAND function to generate a random number for each of the lists. For example, if there were 50 words in your noun list you’d use RAND(1,50) - do the same for the adjective list.

Then with those 2 random numbers you would extract the appropriate word from each of your lists. You can do this easily with the pre-written subroutine macro Get Line From List which you can find here: Get Line From List - #7 by tiffle

After that you can combine the two words you get any which way you like…

Since I’m away from my Mac I’ll leave the construction of the actual macro (which is reasonably straightforward) to you :grinning:

EDIT: Alternatively, instead of using lists you can fill the two variables with comma separated words so they can be treated as KM arrays. You then wouldn’t need to use the separate subroutine macro to extract the random words, just use the array notation for example noun(23) to get the 23rd word from the noun array.

AOTHER EDIT: So - back at my Mac. Try this macro for size: you need to change the red-coloured action to suit your needs (maybe a Copy to clipboard action...)

Test Random Phrase.kmmacros (28 KB)

Click to see macro

BTW I used the word lists from the last example you linked to.

2 Likes