How to use if in applescript

60 Views Asked by At

I'm making a game application in AppleScript. But when I was done it said this "Expected end of line but found ":".". The code I used was

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

Can anyone help?

1

There are 1 best solutions below

0
On

A couple of things. First, display alert with no buttons parameter will just display an OK button, so there's no real reason to check the result. However, if you still want to, or plan on adding additional buttons, you get the result by saving the display alert return value then testing the button returned property of the value, something like this:

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

And finally, if you're using this as some form of DRM, it's pretty weak.