Re: Scripting in OSX: Classic osaxen for Classic apps?
Re: Scripting in OSX: Classic osaxen for Classic apps?
- Subject: Re: Scripting in OSX: Classic osaxen for Classic apps?
- From: Rob Jorgensen <email@hidden>
- Date: Wed, 8 Aug 2001 21:02:17 -0400
on 8/8/01 5:32 PM, Paul Berkowitz at email@hidden wrote:
I'm embarrassed. I've now gone and forgotten how to compile classic osaxen
in classic apps from an OS X Script Editor. I wrote in about this months
ago, Bill Cheeseman confirmed that the recommended method didn't seem to
work and then someone - but I forget who - wrote me showing me how to do it,
and it worked. I reported it to the list. Now I've forgotten it myself.
And then, at 8:33 PM -0400 8/8/01, Bill Cheeseman wrote:
Me, too. But I think Chris Nebel explained how to do it right here. I'll
have to go back and see where I saved it. Maybe tomorrow morning.
This might contain the required info:
On 6/11/01, Chris Espinosa commented:
> 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.)
_______________________________________________
applescript-users mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/applescript-users
Later,
Rob Jorgensen
Ohio, USA