Re: osascript from the terminal: error?
Re: osascript from the terminal: error?
- Subject: Re: osascript from the terminal: error?
- From: Christopher Nebel <email@hidden>
- Date: Fri, 30 Mar 2001 15:15:50 -0800
On Friday, March 30, 2001, at 02:40 AM, Timothy Bates wrote:
hi there,
just playing with osascript from the terminal, and I get errors
[localhost:~] tim% /usr/bin/osascript 2 + 2
Syntax error: Expected expression but found end of script. (-2741)
Of course 2+2 is a perfectly valid script. Any ideas on these errors?
(man osascript does not define them)
You're trying to use osascript in a way which happens to (sort of) work,
but isn't really supported and is going to go away. The arguments are
supposed to be files, not raw script text. If you want to sidestep
using a file, you can do something like this instead:
echo 2+2 | /usr/bin/osascript
The problem in your case is that 2 + 2 (notice the spaces) is
interpreted as three separate arguments; osascript is trying to execute
each one separately. The error is coming from the "+".
[localhost:~] tim% /usr/bin/osascript beep
but I hear nothing (I do hear the beep in script debugger (which is so
far
flawless in classic box), so it is not the no sound in X bug).
Now this one is more interesting. It looks like sound triggered from a
particular process gets cut off when the process terminates.
Essentially, the script is quitting too quickly for you to hear the
beep -- if you add a "delay" call after the beep, then you'll hear it.
I'm not sure if this should be considered a bug or not -- I'll have to
ask the sound guys.
(who is very unhappy that UI scripting additions no only be called when
the
app that is playing the script is front-most [because only
script-playing
apps can access additions ;-(]
Why do you care about this, exactly? I did have real reasons for making
this change, but it's difficult to explain, and if it annoys enough
people we may be able to change it back.
--Chris Nebel
AppleScript Engineering