Guida di AppleScript

1

Sto provando a creare un'app che aprirà app diverse e ti fornirà un elenco, ma continuo a ricevere messaggi di errore. È possibile farlo?

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
    
posta PLASMAGHOST 06.02.2016 - 16:28
fonte

1 risposta

2

Utilizza invece ( fonte e breve spiegazione ):

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 ...
    
risposta data 06.02.2016 - 17:17
fonte

Leggi altre domande sui tag