Applescript choosing

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

  1. macrumors regular

    Joined:
    Apr 18, 2008
    Location:
    somewhere on the Earth
    #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

    Joined:
    Nov 27, 2005
    Location:
    RI
    #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. thread starter macrumors regular

    Joined:
    Apr 18, 2008
    Location:
    somewhere on the Earth

Share This Page