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

    #1
    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

    lancestraz

    #2
    Do you mean something like this?
    Code:
    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

    #3
    Yes thank you very much for the script.
     

Share This Page