Syntax error then expected but found

display dialog "Are you awesome" buttons <"Yes", "No">default button 1
if the button returned of the result is "Yes" then
tell application "Finder"
display dialog "You Passed the Test" buttons <"YAY", "Poop nugets">default button 1
end tell
display dialog "Cool" buttons <"Ok", "More Info">default button 1
if the button returned of the result is "More Info" then
tell application "Finder"
display dialog "You are obviously are awesome,
100% Cool" buttons <"Ok">default button 1
end tell

Then it says:
Syntax error: Expected end of line but found end of script.

iMac, Mac OS X (10.6), Core 2 duo

Posted on Mar 7, 2011 6:55 AM

All replies

Loading page content

Page content loaded

Mar 7, 2011 6:56 AM

Ok. First of all, why are you telling Finder to display dialog? Use this:

That should work, but I don’t have a mac with me to test it on.

Mar 7, 2011 8:10 AM

You missed two end ifs at the end of the script, it should look like thise:

Message was edited by: DJ Bazzie Wazzie (code tag added)

Mar 7, 2011 9:14 AM

Syntax Error: Expected end of line but found end of script.

This error means Applescript compiler didn’t find a some terminator. I first look for a missing double quote (")

These are a pain to find. I follow this motto:
save early save often.

I save every few lines. This way you know the problem is most likely in the lines you changed.

Mar 7, 2011 11:10 AM

can somebody fix this scrip becasue i am having the exact same problems

tell application "SpeechRecognitionServer"

set theResponse to listen for <"yes", "no">with prompt "Hello Michael, Would you like the internet?"

if theResponse is "yes" then

Читайте также:  Handset software update tool

launch application "Google Chrome"

tell application "SpeechRecognitionServer"

set theResponse to listen for <"yes", "no">with prompt "What about a Calander?"

if theResponse is "yes" then

launch application "ical"

tell application "SpeechRecognitionServer"

set theResponse to listen for <"yes", "no">with prompt "How about some iTunes Music?"

if theResponse is "yes" then

launch application "itunes"

tell application "SpeechRecognitionServer"

set theResponse to listen for <"yes","no">with prompt "Would you like me to stop?"

if theResponse is "no" then

if theResponse is "no" then

Mar 22, 2012 7:17 PM

That is a bit of a mess, so I just made a guess at what it is supposed to do. You need to make sure each control statement ( if. then. else. end if , tell. end tell , repeat. end repeat , etc) is terminated correctly, and if inside other control statements, placed in the proper spot to get the logic you are looking for.

Refer to the AppleScript Language Guide for more information about the various control statements and their syntax.

Also, your problem is not related to the original poster’s, so in the future you should start your own topic instead of tacking on to one that is a year old.

Mar 22, 2012 9:18 PM

IS thier a way to make pressing a key act like pressing a button in a display dialog. so say pressing the key a on your keybord will be like clicking on one of the buttons?

Mar 23, 2012 7:46 PM

If you are talking about doing that from the same script, then not really — the script normally waits until the dialog is dismissed before continuing. For dialogs in other applications you can use System Events.

The tab key will cycle through the buttons if you have the Full Keyboard Access option set for all controls, and the space bar will "press" the current button in focus — the return key will also "press" the default button, if one has been set.

Читайте также:  R6016 not enough space for thread data

Mar 23, 2012 7:58 PM

i thought that the following script would go into my ical and tell me what events i have for the current date, yet no matter if i do or do not actually have an event on that day it continues to tell me missing value. im confused why it is not working. also is their a way (once the script works) to have the events displayed in a display dialog?

tell application "iCal"

set d to the current date

repeat with c in every calendar

tell c

if exists event 1 then

set e to (get every event where ((its start date ≤ d ) and (its end date ≥ d )))

if ( e is not <>) then return first item of e

else

return missing value

end if

end tell

end repeat

Primary tabs

имется у нас две ошибки =

D:Bu-Bu raining programsmyCOS 1 ask1.h(8): error #2001: Syntax error: expected ‘)’ but found ‘*’.
D:Bu-Bu raining programsmyCOS 1 ask1.h(8): error #2161: Extraneous old-style parameter list.

возникают в таком вот заголовочном файле task1.h =

вообще список ошибок такой =

Building task1code.obj.
Building task1.obj.
D:Bu-Bu raining programsmyCOS 1winfunc.h(10): warning #1039: [ISO] No newline at end of file.
Building winfunc.obj.
D:Bu-Bu raining programsmyCOS 1 ask1.h(7): error #2001: Syntax error: expected ‘)’ but found ‘*’.
D:Bu-Bu raining programsmyCOS 1 ask1.h(7): error #2161: Extraneous old-style parameter list.
D:Bu-Bu raining programsmyCOS 1winfunc.h(10): warning #1039: [ISO] No newline at end of file.
*** Error code: 1 ***
Done.

попытаемся их исправить.

появляется в случае если компилятор не знает — что за тип указан или же присутствует неявная ошибка в синтаксисе — например, если получается так, что вы инициализируете структуру с помощью фигурных скобок <. >, но внутри размещая не константы , а переменные -в нашем случае достаточно включить заголовочный файл, содержащий определение типа переменной FILE

Читайте также:  Format 48000 hz 32 bit stereo

can any one fix this?

write(‘Enter a selection(10,20,30,40):’);

writeln(’10 was selected’);

writeln(’20 was selected’);

writeln(’30 was selected’);

writeln(’40 was selected’);

writeln(‘something else was selected’);

5 Answers

I don’t know any Pascal, but isn’t the problem obvious? Read your own title: you have a syntax error where you have accidentally used a fullstop where you should have used a semicolon. Look at the last line of your code. I assume you should have used a semicolon instead of a full stop to get:

Also, syntax errors would be less frequent if you used a code editor which had support for syntax highlighting so it would be more obvious where the syntax of your code is incorrect.

  • Login to reply the answers Post

  • Login to reply the answers Post

You have too few ends. The case-statement contains a number of items each wrapped in their own begin-end pair, the penultimate end is the end of one such pair. The last end in your code is the end that matches the start of the case-statement.

The compiler is expecting to see and end that matches the begin that comprises the body of the program, but it encounters a . instead.

  • Login to reply the answers Post

So amazed that I found this topic already answered! Its like you’ve read my thoughts!

Rate this post

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *