Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .