Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 1.2

COLUMN

Open Up to AppleEvents

Let others control your program using AppleEvents

Issue: 1.2 (October/November 2002)
Author: Dean Davis
Author Bio: Dean Davis runs AfterTen Software and is the creator of WeatherManX. He believes all programs should have some form of AppleScript interaction.
Article Description: No description available.
Article Length (in bytes): 6,040
Starting Page Number: 42
Article Number: 1121
Resource File(s):

Download Icon 1121.zip Updated: 2013-03-11 19:07:56

Related Web Link(s):

http://www.panix.com/~gmcgath/EightyRez.html
http://www.mathemaesthetics.com/ResorcererIndex.html

Excerpt of article text...

All Macintosh programs should allow some control over themselves by other programs. The key to that goal is building an 'aete' resource for your program. What does 'aete' stand for? It stands for Apple Event Terminology Extension. If your program has an 'aete' resource it can receive AppleEvents of your design.

Enabling you program to respond to AppleEvents is a two step process. Step one is building the 'aete' resource and step two is writing code to act on AppleEvents sent from other programs. AppleScript is simply a programming language whose purpose is to send AppleEvents to programs and process the responses.

For step one you need an 'aete' resource editor. Classic users get off easy: the free editor EightyRez is available at http://www.panix.com/~gmcgath/EightyRez.html. OS X users who want a native resource editor can use Resorcerer (http://www.mathemaesthetics.com/ResorcererIndex.html), but it is not free.

We will start with the most simple of examples: a new program that can respond to a single AppleEvent and return an integer value. Fire up EightyRez and choose New from the File menu. In an AppleScript dictionary related commands are grouped into suites. Your new resource will already have the "Required" suite. The commands allowed in this suite are pre-defined by Apple and while we should implement them, for this exercise we won't. But we will start a new suite for our custom events.

Under the aete menu choose New Suite. Give it any four letter code as the "ID". Give the suite a name and description. Under the new suite highlight the "events" list and choose New Event& from the aete menu. Type mcmd in the "ID" field and rbas in the "Class" field. Fill in "Name" with the word TestAE and "Description" as Tests the application's Apple Event ability. In the "Reply Type" drop-down choose TypeInteger. Click "OK" and save this file as MyApp.aete.

...End of Excerpt. Please purchase the magazine to read the full article.