我的第二个按钮有返回问题。如果你能帮忙,请这样做,这是 AppleScript 编辑器

时间:2021-08-01 22:56:52

标签: macos applescript

display dialog "Error, Could not open chosen application. Try again in a few moments" buttons {"Report", "Ignore"} with icon 0
set the choice to the button returned of the result
if the choice is "Report" then
    display dialog "Reporting to apple" with icon 0
end if

set the choice to the button returned of the result
if the choice is "Ignore" then
    display dialog "ERROR ERROR. Computer Breached by Harmful Entity" with icon 0
end if

1 个答案:

答案 0 :(得分:0)

对您的代码进行这些细微的调整应该可以实现您想要实现的目标。

在任何 activatedisplay dialog 命令之前插入 display alert 命令将确保对话框或警报窗口不会丢失在您可能打开的任何其他窗口之后。它应该把他们带到前面

activate
set theChoice to button returned of ¬
    (display dialog "Error, Could not open chosen application. Try again in a few moments" buttons ¬
        {"Report", "Ignore"} with icon 0)
if theChoice is "Report" then
    activate
    display dialog "Reporting to apple" with icon 0
else
    activate
    display dialog "ERROR ERROR. Computer Breached by Harmful Entity" with icon 0
end if