Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Keytachi

macrumors regular
Original poster
Sep 14, 2006
161
0
how do i use the random command? i want the computer to say randomly some phrases how do i do that?

btw the "make your computer greet you" v.2.0 is almost out :D
 

Unorthodox

macrumors 65816
Mar 3, 2006
1,087
1
Not at the beach...
This AppleScript will do it.
The only changes you need to make to this script is to modify the top two variables.

AppleScript said:
set amount_of_greetings to 5 -- set this to the amount of items in the variable below
set message_list to {"Hello", "Hi", "Waz up", "Howdy", "Long time no see"} -- add or modify the text in quotes

set message_number to random number from 1 to amount_of_greetings
set the_greeting to item message_number of message_list
display dialog return & the_greeting & "!" buttons {"OK"} default button 1 with icon 2
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Unorthodox said:
This AppleScript will do it.
The only changes you need to make to this script is to modify the top two variables.
Good but,
Code:
set message_list to {"Hello", "Hi", "Waz up", "Howdy", "Long time no see"} -- add or modify the text in quotes
set amount_of_greetings to the count of message_list 

set message_number to random number from 1 to amount_of_greetings
set the_greeting to item message_number of message_list
display dialog return & the_greeting & "!" buttons {"OK"} default button 1 with icon 2
is better, as the computer counts the list automatically.
 

Unorthodox

macrumors 65816
Mar 3, 2006
1,087
1
Not at the beach...
Eraserhead said:
Good but,
>snip< is better, as the computer counts the list automatically.
Ahh.
Yes.
Well, I didn't really devote that much time thinking about how to make it more user friendly.

WAAAA IM SUCH A NOOB!!!!
*sobs uncontrollably*

Since you're such a pro....
Maybe you can answer this?
*sniff*
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.