[futurebasic] Re: Help needed: Applescript, FB and OS 8.5

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1999 : Group Archive : Group : All Groups

From: Keith Ronnholm <ronnholm@...>
Date: Thu, 11 Mar 1999 11:57:08 -0800
Two weeks ago (Digest 765)  I sent the list a message asking for help 
on why my implementation of Applescript in a FB program no longer 
worked under 8.5, when it worked fine under prior OS versions.

Thanks to those of you who responded.  I've finally fixed the problem 
and would like to share the fix with the list, to help those who run 
into a similar problem in the future.  Bear in mind that what you are 
about to read could be in error, as it was only learned in the last 
10 days, but it appears to work.

To add Applescript support to an FB program you need to add two 
components.  One is internal support in your code, the other is an 
aete resource.  It's the aete resource that I didn't know about. 
Adding it fixed the problem.

To add the internal code, I used installed support for Applescript in 
my FB program several years ago using various code snipits and 
suggestions from this list & its AOL predecessor.  But I think the 
way to go now is to use Staz's Apple Events filter.  I just bought 
it, but haven't used it, since the fix for my program was elsewhere. 
I hear good things about the filter so check it out.

FB programs need an aete resource if they support Applescript 
commands beyond the basic core suite that Apple includes in the OS. 
In my case, I installed support for the Do Script "xxxx" command 
which simply passed the text string "xxxx" to my program and passed 
back a text string which appeared in the Applescript result window. 
But Apple removed Do Script from the standard suite when they revised 
the Mac OS to 8.5.  So by adding an aete resource to my compiled 
code, I got my Do Script functionality back.  You will need to add an 
aete resource if you define any of your own events, or event suites 
specific to your program.  New events also need to be registered with 
Apple.

So what do you need to have to work with aete resources?  ResEdit 2.1 
will work, but ONLY if you add some resources to ResEdit that permit 
it to understand and display aete resources.  I got from Apple a 
folder  (ResEdit 'aete' Editor 1.0b4)  on a developer tools disk, but 
it is perhaps also on their web site.  Commercial programs like 
Resourcerer and EightyRez will also work, probably better than an 
enhanced Resedit, but they also cost more.  I think programming 
environments like Code Warrior and MPW also can work with aete 
resources.

To see what Applescript events are available, look at the aete 
resource of applications, or the aeut resource of the Applescript 
Dialect file, found under Scripting Additions in the System folder. 
As best I can tell, aeut resources are what Apple provides, and aete 
resources are what programmers add to their programs.  I found that 
the Do Script event was present in the aeut resource for the OS 8.1 
dialect file, but was gone in the 8.5 dialect file.

A bit of sluthing later, I found the following in a file on Apple's 
web site that described changes under 8.5 -  "The copy and do script 
events were removed from the Standard suite.  The copy event is 
ambiguous and has been replaced by the Clipboard events in the 
Standard Additions; removing the event from the Standard suite will 
prevent confusion with AppleScript's built-in copy command.  The do 
script event will be moved into the Miscellaneous Standards suite." 
The key here is "will be".  Not yet done!!

Although you can create your own events from scratch using an aete 
capable resource editor, I took the easy road and found a program 
that already had what I wanted in an aete resource - Filemaker Pro 
2.0.  I copied the aete resource to my program, and then deleted the 
95% of the events, classes, enumerations, etc that were not relevant 
to my program.  I was left with an aete resource that had Do Script 
in it, and a working program under 8.5!!  I could have copied all the 
Do Script settings and choices out of Apple's aeut resource, but the 
cut, paste and delete saved some time.

But what the aete resource also provides is a dictionary entry.  When 
using Apple's Script Editor, you can view an applications' 
Applescript dictionary (see the File menu).  The Applescript 
dictionary is intended to provide scripters with a list of the 
commands that will work with that application.  Now Do Script 
appears, and I've even added notes to explain what you can do with it 
when using Applescript with my application.

For more information, I'd point folks to MacTech magazines web site 
(http://www.mactech.com) and in particular, their July 95 archived 
issue which has an article "Making sense of 'aete' resources".  Also 
the definitive Applescript web site is Bill Cheeseman's 
http://www.AppleScriptSourcebook.com.  It has links to most other 
Applescript related web sites.

I hope this long explanation helps others in the future.
Cheers,

Keith Ronnholm

Remote Measurement Systems, Inc.
2633 Eastlake Ave. E., Suite 200
Seattle, WA 98102

Phone: (206) 328-2255
Fax: (206) 328-1787
ronnholm@...
http://www.measure.com