Tuesday, September 17, 2019

#1 2019-04-19 06:42:45 am

bulletinki
Member
Registered: 2019-03-25
Posts: 3

Repeat Help

I need help with repeats.
Im trying to make a story, and at the end it asks, "You got all that?" I want it so if you say yes, it exits the repeat, if you say no, it says the story again, this is what I have so far

Applescript:


display dialog "blah blah" giving up after 5
   display dialog "blah blah blah" giving up after 7
   display dialog "blah!" giving up after 3
   display dialog "blah blah, blah bluh!!!" giving up after 5
   display dialog "blah?" giving up after 8
   display dialog "Got all that?" buttons {"Yes", "No"} default button 1
   if the button returned of the result is "Yes" then


how did i get here i am not gud with computr


Filed under: repeat

Offline

 

#2 2019-04-19 08:31:37 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3576

Re: Repeat Help

You may try:

Applescript:

repeat
   display dialog "blah blah" buttons {"OK"} default button 1 giving up after 5
   display dialog "blah blah blah" buttons {"OK"} default button 1 giving up after 7
   display dialog "blah!" buttons {"OK"} default button 1 giving up after 3
   display dialog "blah blah, blah bluh!!!" buttons {"OK"} default button 1 giving up after 5
   display dialog "blah?" buttons {"OK"} default button 1 giving up after 8
   display dialog "Got all that?" buttons {"No", "Yes"} default button 2
   if the button returned of the result is "Yes" then exit repeat
end repeat

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 19 avril 2019  16:31:24

Browser: Safari 605.1.15
Operating System: macOS 10.13

Offline

 

#3 2019-04-19 10:08:30 am

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 156

Re: Repeat Help

The OP is looking for something simple and Yvan's answer is clearly the correct one. A short time ago, Yvan introduced me to the usefulness of a list of lists, and I thought I would rewrite the OP's script this way, just for practice.

Applescript:

set dialogData to {{"blah blah", 5}, {"blah blah blah", 7}, {"blah!", 3}, {"blah blah, blah, bluh!!!", 5}, {"blah?", 8}}

repeat
   repeat with aDialog in dialogData
       display dialog (item 1 of aDialog) buttons {"OK"} default button 1 giving up after (item 2 of aDialog)
   end repeat
   display dialog "Got all that?" buttons {"No", "Yes"} cancel button 2 default button 2
end repeat

Last edited by peavine (2019-04-19 03:06:53 pm)


2018 Mac mini - macOS Mojave

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)