[英]How to use if in applescript
我正在用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
有人可以帮忙吗?
有几件事。 首先, display alert
无buttons
display alert
参数只会显示一个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,则它非常薄弱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.