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
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
You may try:
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
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.
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