I have an app coded in Applescript where a dialog pops up with three buttons: {Help, Add, Subtract} . When user taps the Help button, a dialog should popup displaying information about the app.This dialog will have a {Cancel,Continue} button. When user taps the Continue button, he should be returned to the previous dialog( The dialog with three buttons: {Help, Add, Subtract}). But I cant get it to work. Here is my code:

set question to display dialog "I want to" buttons {"Help", "Add", "Subtract"} default button 2

set response to button returned of question

if response is equal to "Help" then

  Help()

 end if

ere is my Help Function

 on Help()

   display dialog "blah blah" buttons {"Cancel", "Continue"}

return

 end Help

How do I resume execution with the dialog with three button?

link|improve this question

71% accept rate
feedback

1 Answer

You can “go back and do it again” with a repeat loop:

repeat
    ⋮
    set response to …
    if response is equal to "Help" then
        Help()
    else
        exit repeat
    end if
end repeat

Or with repeat while:

set response to "Help" -- just the inital condition
repeat while response is equal to "Help"
    ⋮
    set response to …
    if response is equal to "Help" then
        Help()
    else
end repeat
link|improve this answer
I get an error: "Finder got an error: Cant continue Help" I forgot to add that this code is enclosed inside 'tell application "Finder"' – smokinguns May 21 '11 at 4:21
Use my to call to your own handlers from inside an application tell block: my Help(). – Chris Johnsen May 21 '11 at 4:59
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.