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

Is there an applescript for displaying a random word from a list of supplied words?

Discussion in 'Mac Programming' started by SuperDaveInLA, Jul 21, 2010.

  1. macrumors newbie

    I have an apple workflow running off of my laptop for a DIY photo booth at my wedding. The user only has to enter his/her name - the computer then takes 3 snapshots from webcam, formats them into strip form, sends them to a printer, then loops and starts over. What I'm trying to do now is before each snapshot I'd love a dialog to show a random emotion that the user should portray in each shot.

    What I want to do is have a list of like 30 possible scenarios ("extremely happy" "shocked" "the person next to you smells", etc etc etc.) and have the computer pick one of them to display before each shot.

    Any idea how to do this?!
  2. macrumors 6502

    Here you go. Edit it however you'd like:

    set emotions to {"Happy", "Sad", "Angry", "Funny", "Confused", "Shocked"}
    set randomEmotion to some item of emotions
  3. macrumors newbie

    Caleb - sorry if I'm out of my league here, but that script isn't displaying anything. It's running, but I'm not seeing anything. Am I doing something incorrectly?
  4. macrumors newbie

    oh sweet, i think i figured it out! Added display dialog randomEmotion

    Thank you dude!
  5. macrumors regular

    You can also pick from a file, etc

    There are literally dozens of ways to do this.

    Seriously, look into some of the AppleScript tutorials online. AppleScript is surprisingly powerful, and very straightforward.


Share This Page