Syntax Error in Script Editor

Hey everybody. I'm brand new to Mac's (and programming for that matter). I've been trying to do some basic programming with AppleScript based on guides I found online. After making sure I copied the guide's code EXACTLY, I still get a Syntax error, which reads "expected "," or "}" but found property. The word "AppleScript" is highlighted in this instance. Strangely enough, no other instances of "AppleScript" are targeted with this error message. Like I said before, I've made sure to carefully copy everything from the guide I read and have done it multiple times, but still get this error message. Any help would be greatly appreciated!!

Macbook, Mac OS X (10.5.3)

Posted on Jun 21, 2008 1:47 PM

Reply
9 replies

Jun 21, 2008 2:49 PM in response to orangekay

Ok, it's right here.

set answer to the button returned of (display dialog ¬
"Welcome to the AppleScript Humor Game. Click on the " & ¬
"Tell Me Some Jokes button to " & ¬
"have a few laughs or click on the No Thanks button to quit." ¬
buttons {"Tell Me Some Jokes", "No Thanks"} ¬
with title "AppleScript Humor Game" with icon note)

if answer = "Tell Me Some Jokes" then

display dialog "My new application said it requires Windows XP " & ¬
"or better...So I installed Mac OSX." ¬
buttons {"OK"} with title "AppleScript Humor Game" with icon notes

display dialog "The great thing about computers is that they " & ¬
"let you make mistakes even faster than before." ¬
buttons {"OK"} with title "AppleScript Humor Game" with icon note

display dialog "To err is human but to really mess things up " & ¬
"You need a computer." buttons {"OK.} ¬
with title "APPLESCRIPT Humor Game" with icon note

display dialog "Policemen are very strong. They can even hold " & ¬
"up traffic." buttons {"OK."} ¬
with title "AppleScript Humor Game" with icon note

display dialog "What do you call a soup made of onions and " & ¬
"beans? Tear Gas!" buttons {"OK"} ¬
with title "AppleScript Humor Game" with icon note

else

display dialog "You do not know what you are missing!" buttons {"OK"} ¬
with title "AppleScript Humor Game" with icon note

end if


The caps locked APPLESCRIPT is the one that's having the problem. It's in the section that begins "Display dialog "To err..."

Is this enough information for help?

Jun 21, 2008 7:57 PM in response to Macavity22

Having another small problem. Two problems to be exact. Here is the code I have so far.


set answer to the button returned of (display dialog ¬
¬
"Welcome to the haunted house. Enter at your own risk. You have two options: Choose to Continue, or Run away." buttons {"Continue", "Run Away"} ¬
with title "AppleScript Confusion" with icon note)

if answer = "Continue" then

display dialog ¬
"You step into the foyer of the house and see two hallways on either side of you. Go left, or go right?" buttons {"Left", "Right"} ¬
with title "AppleScript Confusion" with icon note

if answer = "Right" then

display dialog ¬
"You step on a trap door and fall into a pit. You lose the game." buttons {"Exit"} ¬
with title "AppleScript Confusion" with icon note

else

display dialog ¬
"You walk down the hallway cautiously until you encounter a door." buttons {"Open Door"}
with title "AppleScript Confusion" with icon note

end if

else

display dialog ¬
"You run out of the haunted house, starting your car and driving away." buttons {"Exit"} ¬
with title "AppleScript confusion" with icon note


First problem: the response doesn't seem to be working at all. I've clicked both buttons but only get the response under

else

I can't seem to get the response that's under

if answer = "Right" then

even if I am clicking the button that says "Right"


Second problem:

"with title "AppleScript Confusion" with icon note" in the paragraph under "else." Whenever I try to compile, the word "title" is highlighted and I get the error message "expected "timeout" or "transaction" but found identifier."

An answer to one or both questions would be greatly appreciated!!

Jun 21, 2008 8:14 PM in response to Macavity22

"with title "AppleScript Confusion" with icon note" in the paragraph under "else." Whenever I try to compile, the word "title" is highlighted and I get the error message "expected "timeout" or "transaction" but found identifier."


You're missing ¬ following "Open Door". Adding that and a closing "end if" fixed the other problem as well.

(33051)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Syntax Error in Script Editor

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.