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
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)
BTW I used the word lists from the last example you linked to.