set var to "Which Application would you like to open?"
display dialog var buttons {"Cancel", "Safari", "Calculator"}
if button returned of result is "Calculator" then
display dialog "Are you sure?" buttons {"No", "Yes"} default button 2
if button returned of result is "Yes" then
tell application "Mail" to activate
end if
else
display dialog "Are you sure?" buttons {"No", "Yes"} default button 2
if button returned of result is "Yes" then
tell application "Safari" to activate
end if
if button returned of result is "Cancel" then
return
end if
end if
答案 0 :(得分:0)
result
仅指上面的一行。如果您想稍后使用它,则需要将其存储为另一个变量。
set TheResult to button returned of result
答案 1 :(得分:0)
您可能应该尝试在此论坛中格式化您的代码,以帮助人们尝试帮助您。你不需要最后一次"取消"选项,您还要询问用户是否要启动"计算器"但随后你推出了#34; Mail"。我对您的代码进行了一些修改并重新发布。
set var to "Which Application would you like to open?"
display dialog var buttons {"Cancel", "Safari", "Calculator"}
if button returned of result is "Calculator" then
display dialog "Are you sure?" buttons {"No", "Yes"} default button 2
if button returned of result is "Yes" then
tell application "Calculator" to activate
end if
else
display dialog "Are you sure?" buttons {"No", "Yes"} default button 2
if button returned of result is "Yes" then
tell application "Safari" to activate
end if
end if