Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 31, 2009, 08:03 AM   #1
dtfgator
macrumors newbie
 
Join Date: Oct 2009
Applescript Dialog Box

Hi!

I am trying to replicate the MIT MS-Dos "Cookie" virus. It displays text "I want cookies. give me cookies" and if the user types cookies, it disappears.

I dont have much yet. I need the applscpt to distinguish the entered text (cookie or else).

I am a script noobie so if anyone could add on to this it would be great.

Code:
display dialog "I want cookies.  Give me cookies." default answer "" buttons {"OK"} default button 1
if answer = "cookies" then beep 10
I need a way to define "answer" as the user response. Once I get this I can complete it.

Thanks!
dtfgator is offline   0 Reply With Quote
Old Oct 31, 2009, 02:08 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
Code:
set answer to text returned of (display dialog "I want cookies.  Give me cookies." default answer "" buttons {"OK"} default button 1)
if answer = "cookies" then beep 10
The text returned is one of the items in the dialog reply record that display dialog returns.

In Script Editor.app, choose Open Dictionary. Scroll down to Standard Additions and choose it. Under User Interaction is the display dialog command; click it. Notice what it returns: dialog reply; click its link.
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Mac OS Lion dev. 4 Curious Dialog Box -BigMac- Mac OS X 10.7 Lion 5 Aug 9, 2011 06:11 PM
Update dialog in R U S S I A N! Odisey Windows, Linux & Others on the Mac 0 May 27, 2011 08:50 AM
Applescript - Renaming a file with text returned from dialog box gocardsfan1 Mac Programming 0 Jun 7, 2009 11:21 PM
Set a dialog box always to show up on front/top AppleScript MacBook MH Mac Programming 1 May 31, 2009 10:24 AM
AppleScript dialog boxes I'm a Mac Mac Programming 1 Apr 10, 2008 09:10 PM


All times are GMT -5. The time now is 01:44 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC