Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

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
share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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