Help with making a script to display random message.

What I need help with is the right piece of code to make a script display a randomly selected message from a list of ten or so. I dont know how to explain it any better. This is what I have so far.

set randomMessage to (random number from 10 to 20)
display dialog " " & randomMessage & " "

Hi,

Do you search for something like this?


set greetings to {"Hallo", "Bonjour", "Hi", "Yo", "Hello", "Ola", "Hola", "Aloha", "Salve", "Salut"}
set randnum to random number from 1 to 10

tell application "System Events"
	set yourname to full name of current user
end tell

set msg to (item randnum of greetings) & ", " & yourname & "!"

display dialog msg buttons {"OK"} default button 1 with icon note

Best regards from Old Europe,

Martin

If it’s only ten or so “some” is the way to go:


set tMsgs to {"Hi There!", "You're Nuts", "Aloha", "Take me to your leader, Earthling"}
display dialog (some item of tMsgs)