AppleScript- how to keep a dialog box open after clicking a button?

Discussion in 'Mac Programming' started by MacBook MH, Mar 2, 2010.

  1. MacBook MH macrumors member

    Joined:
    Mar 7, 2009
    #1
    How do I keep the dialog box open after clicking a button?
    Situation:
    how do i get the first dialog to stay open when i click the download button
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  3. MacBook MH thread starter macrumors member

    Joined:
    Mar 7, 2009
    #3
    so... if you THINK you cant... any suggestions?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Just re-open the same dialog? Put it in a loop that only terminates when Quit is selected...
     
  5. MacBook MH thread starter macrumors member

    Joined:
    Mar 7, 2009
    #5
    how should I do it? the loop should end also when the start >> button is clicked....
    please could you paste the scriptlet here?
    thanks
     
  6. MacBook MH thread starter macrumors member

    Joined:
    Mar 7, 2009
    #6
    the /question/ is a variable... couldnt i just display it once more after clicking download.... an if so how?
     
  7. -aggie- macrumors P6

    -aggie-

    Joined:
    Jun 19, 2009
    Location:
    Where bunnies are welcome.
    #7
    How's this?

    Code:
    repeat
    set question to display dialog "What do you want to do?" buttons {"Quit", "Download", "Start >>"} default button 2
    set answer to button returned of question
    
    if answer is equal to "Start >>" then
    set asker to display dialog "Which Machine?" buttons {"1st Machine", "Other machine(s)"} default button 1
    exit repeat
    
    else
    if answer is equal to "Quit" then
    tell application "System Events" to quit
    display dialog "Quitting."
    exit repeat
    end if
    
    else
    if answer is equal to "Download" then
    tell application "Safari"
    activate
    do JavaScript "window.open('http://www.downloadthefile.com')" in document 1
    end tell
    end if 
    
    end if
    end repeat
     

Share This Page