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

Similar Threads
thread Thread Starter Forum Replies Last Post
AppleScript Dialog NecroDayz Mac Programming 3 Apr 24, 2014 11:35 AM
Choose application dialog opening when not needed in my Applescript hary536 Mac Programming 2 Nov 15, 2013 01:14 PM
Help with Applescript dialog box Habbfreaky Mac Programming 3 Aug 22, 2013 02:28 PM
Retina+a dialog box rmger OS X 10.8 Mountain Lion 0 Jul 16, 2013 06:22 PM
Printing dialog box BMoran iMac 2 Nov 19, 2012 05:36 PM

Forum Jump

All times are GMT -5. The time now is 04:56 AM.

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

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