• 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: Running Stay-open scripts from the command line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running Stay-open scripts from the command line


  • Subject: Re: Running Stay-open scripts from the command line
  • From: Michael Ellis <email@hidden>
  • Date: Thu, 24 May 2001 23:59:35 -0400

>Check out OSAExecute. It is totally "behind the scenes", doesn't spawn a
>separate process, and is used by apps such as Smile that use Applescript
>for internal purposes. (Smile is largely written in Applescript.)
>
>--
>bill
>

At Bill's suggestion, I have been looking into Carbon's OSA routines as
an alternative to spawning a child "/usr/bin/osascript" process. It
looks like using a combination of OSACompile/OSAExecute might be just
what I need.

However, I am finding that OSAExecute reports "script doesn't understand
the message xxx" where "xxx" is ANY handler declared in the script. In
fact, I created a trivial script like this one:

my message("Hello")

on message(textVar)
log "Message = " & textVar
end message

I found that ScriptEditor had no trouble running it. However, when I
execute the following it reports "script doesn't understand message
message":

resultID = kOSANullScript;

// This works fine
errorCode = OSACompile(myComponent, &gScriptDesc, kOSAModeNull,
&resultID);

// This runs the script up to a handler call and then quits with an error
errorCode = OSAExecute(myComponent, resultID, kOSANullScript,
kOSAModeNull, &resultID);

Any suggestions? I was thinking that it might be a problem with running
the script in the default context, but further investigation seems to
indicate that it isn't that. I am calling this Carbon code from a Cocoa
application -- could it have something to do with the Apple Event Handler
(or lack of one)?

Any thoughts?

-Mike Ellis



==========================================================================
Michael Ellis Phone: 941-377-5562 x5169
Systems Analyst Manager FAX: 941-377-5590
Medical Education Technologies, Inc. (METI) Internet: email@hidden


  • Prev by Date: Re: Interarchy most reliable scripting version
  • Next by Date: Re: Thanks and another question
  • Previous by thread: Re: Running Stay-open scripts from the command line
  • Next by thread: Re: Running Stay-open scripts from the command line
  • Index(es):
    • Date
    • Thread