• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: osascript from the terminal: error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • URL Access Scripting and HTTPS?
      • From: Doug McNutt <email@hidden>
References: 
 >osascript from the terminal: error? (From: Timothy Bates <email@hidden>)

  • Prev by Date: Re: Scripting network settings for OS X
  • Next by Date: Script editor/Finder weirdness
  • Previous by thread: Re: osascript from the terminal: error?
  • Next by thread: URL Access Scripting and HTTPS?
  • Index(es):
    • Date
    • Thread