• 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: Scripting in OSX: Classic osaxen for Classic apps?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting in OSX: Classic osaxen for Classic apps?


  • Subject: Re: Scripting in OSX: Classic osaxen for Classic apps?
  • From: Chris Espinosa <email@hidden>
  • Date: Mon, 11 Jun 2001 10:26:34 -0700

> On 6/9/01 3:23 AM, "Bill Cheeseman" <email@hidden> wrote:
>
> on 6/9/01 4:43 AM, Paul Berkowitz at email@hidden wrote:
>
> According to a page in the Help for OS X, you're supposed to be able to
> compile scripts in the OS X Script Editor which refer to classic
> scripting
> additions (for Classic or OS 8/9 use, of course) by enclosing the osax
> terms
> in a 'using terms from' construction, then wrapping that in a tell
> block to
> a classic app.
>
> Except that 'using terms from' is meant to take an application
> reference,
> and osaxen are not applications (it won't compile if you try with
> 'application "osaxName" ').
>
> I pointed this out in my report on AppleScript in Mac OS X. I have no
> solution. I brought it up with Chris Nebel privately at the time, but
> it got
> lost in our other communications about Mac OS X. My assumption is that
> the
> note in Apple Help is just wrong -- it works with scripting additions
> that
> take the form of background applications, not otherwise.
>
>
> Thanks, Bill. I actually had gone back to your page where I thought I
> had
> seen a reference to this, and found it, but missed the "does not work"
> bit.
> I have also been also told, second-hand (no particulars), that someone
> at
> WWDC recently had advised using the file application path of the osax,
> so
> that's why I tried that. Doesn't work either.

It takes eight lines to accomplish what usually can be done in one, but
it does work. Here are the secrets:

- You have to use Using terms From on your osax. Yes, it works, even
for 68K applets.
- You have to target the event to a running Classic application. The
best way to do this is to launch one.
- You have to have an outer Tell block that targets a variable, not an
app name.
- Running from X, your normal "path to" results don't let you find the
Classic scripting additions folder, so you
have to hard-code the path.

Example:

set Launcher to "Launcher"
set StartupDisk to (path to startup disk) as string
launch application (StartupDisk & "System Folder:Control Panels:" &
Launcher)
tell application Launcher
using terms from application "Macintosh HD:System Folder:Scripting
Additions:MonitorDepth"
get monitor depth -- this is the call to the OSAX
end using terms from
end tell

Try it.

Chris (E.)


  • Prev by Date: Re: [ANN] New Snippets: MathLib 1.1 and Map
  • Next by Date: Re: Script Editor
  • Previous by thread: Re: Scripting in OSX: Classic osaxen for Classic apps?
  • Next by thread: Type coercion question
  • Index(es):
    • Date
    • Thread