Macos AppleScript未定义变量

Macos AppleScript未定义变量,macos,applescript,Macos,Applescript,我知道这是一个非常简单的脚本,但我一直收到一条关于未定义变量的错误消息。当我这样做时,就在=“App Store”前面的结果将突出显示。我试过重写剧本的那一部分,但同样的事情一直在发生。有人注意到问题吗 say "Welcome, Master Daniel. It is currently" say time string of (current date) say "All systems are operational. Would you like to open an applicat

我知道这是一个非常简单的脚本,但我一直收到一条关于未定义变量的错误消息。当我这样做时,就在
=“App Store”
前面的
结果将突出显示。我试过重写剧本的那一部分,但同样的事情一直在发生。有人注意到问题吗

say "Welcome, Master Daniel. It is currently"
say time string of (current date)
say "All systems are operational. Would you like to open an application?"
display dialog "Open An Application." buttons ["Mail", "App Store", "More"]
if button returned of result = "Mail" then
tell application "Mail"
    activate
end tell

if button returned of result = "App Store" then
    tell application "App Store"
        actvate
    end tell

else (* do nothing *)
end if
else (* do nothing *)
end if

if button returned of result = "More" then
display dialog "Open An Application." buttons ["Safari", "iTunes", "AppleScript"]

if button returned of result = "Safari" then
    tell application "Safari"
        activate
    end tell

    if button returned of result = "iTunes" then
        tell application "iTunes"
            activate
        end tell

        if button returned of result = "AppleScript" then
            tell application "AppleScript Editor"
                activate
            end tell

        else (* do nothing *)
        end if
    else (* do nothing *)
    end if
else (* do nothing *)
end if
else (*do nothing*)
end if
尝试:

和“应用商店”

至于“更多”:


不需要嵌套所有这些命令。另外,在变量中捕获结果。所以

display dialog "Open An Application." buttons ["Mail", "App Store", "More"]
set the button_pressed to the button returned of the result

if button_pressed = "Mail" then
    tell application "Mail"
        activate
    end tell
end if

if button_pressed = "App Store" then
    tell application "App Store"
        activate
    end tell
end if
if answer is equal to "App Store" then
if answer is equal to "More" then
display dialog "Open An Application." buttons ["Mail", "App Store", "More"]
set the button_pressed to the button returned of the result

if button_pressed = "Mail" then
    tell application "Mail"
        activate
    end tell
end if

if button_pressed = "App Store" then
    tell application "App Store"
        activate
    end tell
end if