1

I'm trying to make an app that will open different apps, and give you a list, but I keep getting error messages. Is it possible to do this?

display dialog "Hello and welcome to my app!" buttons {"Login", "Quit"} default button 1

if the button returned of the result is "Login" then
    display dialog "Username:" buttons {"Admin", "Guest"} default button 1 with title "Choose user"
else
    return
end if

if the button returned of the result is "Admin" then
    display dialog "Enter Pasword" default answer "" buttons {"Submit"} with title "Enter  password" with hidden answer
else
    display dialog "You have selected guest! Guest is not currenty enabled, since this build is in beta. Thank you!" buttons {"OK"}
    return
end if

if the text returned of the result is "Cameron67" then
    display dialog "Welcome! What would you like to do?" buttons {"Chrome", "Messages", "More"}
    if the button returned of the result is "Chrome" then tell application "Google Chrome"
        activate
    end tell
    if the button returned is "Messages" then tell application "Messages"
        activate
    end tell
else
    display dialog "Incorrect password" buttons {"OK"} default button 1 with icon stop
end if
  • 1
    What are the error messages and is it possible to do what exactly? – user3439894 Feb 6 '16 at 15:47
1

Use this instead (source and short explanation):

if the text returned of the result is "Cameron67" then
    set the_results to (display dialog "Welcome! What would you like to do?" buttons {"Chrome", "Messages", "More"})
    set button_returned to button returned of the_results
    if button_returned is "Chrome" then tell application "Google Chrome"
        activate
    end tell
    if button_returned is "Messages" then tell application "Messages"
        activate
    end tell
    if button_returned is "More" then ...

You must log in to answer this question.

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