Macos 如何在applescript中使用if

Macos 如何在applescript中使用if,macos,if-statement,hyperlink,applescript,tell,Macos,If Statement,Hyperlink,Applescript,Tell,我正在制作一个游戏应用程序。但当我完成时,它说这是“预期的结果,但发现”:。我使用的代码是 display alert "By taping ok you accept the following rules: Do not hack, do not cheat, edit komponents or download our site to your desktop! If you do not follow these rules you could get banned" if {but

我正在制作一个游戏应用程序。但当我完成时,它说这是“预期的结果,但发现”:。我使用的代码是

display alert "By taping ok you accept the following rules: Do not hack, do not cheat, edit komponents or download our site to your desktop! If you do not follow these rules you could get banned"

if {button returned:"OK"}
tell application "/Applications/Safari.app"
open location http://www.pipadse.wix.com/games 
end tell

有人能帮忙吗?

有几件事。首先,
display alert
不带
按钮
参数只会显示一个
OK
按钮,因此没有真正的理由检查结果。但是,如果您仍然想要或计划添加其他按钮,则可以通过保存
显示警报
返回值,然后测试该值的
按钮返回
属性来获得结果,如下所示:

set alertResult to display alert "By tapping OK you accept the following rules: Do not hack, do not cheat, edit components, or download our site to your desktop! If you do not follow these rules you could get banned."

if button returned of alertResult is "OK" then
    display alert "OK was pressed"
end if
最后,如果你用它作为某种形式的数字版权管理,它是非常弱的