And the winner is ...

Jul 07, '03 10:27:00AM

Contributed by: robg

There were a total of 1,385 unique entries for the free book giveaway ... and instead of using Excel to pick the winner, my buddy Jacco wrote me an AppleScript to do the work directly in Mail:

tell application "Mail"
  set myfolder to "zBook giveaway"
  set mycount to the count of messages of mailbox myfolder
  set randNum to (random number from 1 to mycount)
  set mysender to sender of message randNum of mailbox myfolder as text
  display dialog "the winner is: " & mysender
  set the clipboard to mysender
end tell
Running this script gave me the following results:


LRogers has been notified by email. In the event that he/she is unable to claim the prize by 5pm today, I'll run the AppleScript again :-). Thanks everyone for participating; I must say I wasn't really expecting over 1,300 emails during the weekend!

-rob.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030707102747428