0

我正在用AppleScript制作游戏应用程序。但是当我完成时,它说这个“预期的行尾但找到了”:“。”。我使用的代码是

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

任何人都可以帮忙吗?

4

1 回答 1

0

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

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

最后,如果您将其用作某种形式的 DRM,它会非常弱。

于 2015-12-29T18:05:02.847 回答