PDA

View Full Version : Is there an applescript for displaying a random word from a list of supplied words?




SuperDaveInLA
Jul 21, 2010, 04:37 PM
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?!



Caleb531
Jul 21, 2010, 05:54 PM
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

SuperDaveInLA
Jul 21, 2010, 06:01 PM
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?

SuperDaveInLA
Jul 21, 2010, 06:11 PM
oh sweet, i think i figured it out! Added display dialog randomEmotion

Thank you dude!

fredfnord
Jul 21, 2010, 07:09 PM
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.

-fred