Re: Certain Answer
Re: Certain Answer
- Subject: Re: Certain Answer
- From: David Andrews <email@hidden>
- Date: Sun, 1 Aug 2004 00:07:42 -0400
I like the one offered by (watch for broken line(s)):
On 29 Jul 2004, at 01:19, Patrick Zittle wrote:
Hey Everyone! I was just wondering what the format for a if-then
script? I would like to ask a display a question and if they insert
anything but the answer it asks the question again. How can I do
this?
...or you could do it without having to use an if/then...
set theAnswer to ""
repeat while theAnswer is not "Paris"
set theAnswer to text returned of (display dialog "What's the capital
of France?" default answer "" buttons {"OK"} default button 1)
end repeat
Hope that helps
r.
On Aug 1, 2004, at 12:00 AM, Andrew Oliver wrote:
I don't think there is a single 'correct' answer to this question.
There are
multiple ways of achieving this. Which one you choose is as much
personal
preference as anything else. For example:
Using 'exit repeat':
repeat
set dialog_reply to display dialog "Enter a number"
set dialog_text to text returned of dialog_reply
if dialog_text = "1" then
exit repeat
end if
end repeat
Using 'repeat until':
set gotAnswer to false
repeat until gotAnswer is true
set dialog_reply to display dialog "Enter a number"
set dialog_text to text returned of dialog_reply
if dialog_text = "1" then
set gotAnswer to true
end if
end repeat
Plus I'm sure there are others I can't think of off-hand.
Andrew
:)
On 7/31/04 8:40 PM, "Patrick Zittle" <email@hidden> wrote:
Hello,
What is the correct way to stop a repeat once a certain answer is
entered into a question dialog? I am asking a question and if the
answer is wrong it will ask the question again through a repeat
command
but I want it to stop after the correct answer is put in. Any help is
appreciated!! Thanks!
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.