1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Applescript choosing

Discussion in 'Mac Programming' started by don't do it, May 30, 2009.

  1. macrumors regular

    Ok i know ive seen it before but i cant seem to find it know. im trying to write a script where the computer has to choose a response from a list and i dont want it to prompt me asking what i want it to say.
  2. macrumors 6502a


    Do you mean something like this?
    set responseList to {"Hi", "Hello", "What's up", "Howdy", "Greetings"}
    set randomNumber to (random number from 1 to (count responseList))
    say (item randomNumber of responseList)
  3. macrumors regular

    Yes thank you very much for the script.

Share This Page