frondoc picture

What is Frontier?
News & Updates

Web Tutorial
Scripting Tutorial
BBEdit Scripting

Mailing Lists
Sample Scripts
Verb Set
Frontier Site Outline


User's Guide
1 2 3 4 5 6
7 8 9 10 11

Apple File Edit
Main Open Suites
Web Window

Menubar Outline
Script Table WP

frondoc picture


How to record scripts with applications that support recording.

Recording is so cool!

There are all levels of application scriptability, starting with apps that just support the four required Apple Events (not too useful) all the way thru applications that implement a well thought out set of Apple Events for scripting.

Recording is more than icing on the cake. Applications that support recording are truly outstanding scriptable applications. The developers who implement recording have made a very substantial investement in your productivity.

Recordability will be a rare feature, we believe, because it can require a very substantial amount of work for the developer. It can be more cost-effective for the developer to invest in more useful sample scripts and documentation than to implement the more impressive recording feature. And there's a cost to recordability, beyond the effort required by the developer: it takes up memory.

As often is the case, Aladdin Systems pioneered this new scripting technology. SITcomm 1.0, released in November 1993, is the first recordable Macintosh application.

Here's how recording works: if you want to find out how to do something from a script, just turn the recorder on, switch into the app, and do it. Recording is the "watch me" mode for Apple Event scripting. It's so cool to see it in action!

A demo...

For this demo, we're using PhotoFlash 1.0 from Apple Computer as the example application. PhotoFlash is not only scriptable and supports menu sharing; it is also recordable. A truly exemplary application.

First, it's very important to have the current Frontier install file for PhotoFlash. If you want to follow along, and you have a copy of PhotoFlash 1.0, be sure to get the current install file for PhotoFlash. Versions of PhotoFlash after 1.0 may include the Frontier install file on the distribution disk.

Here's the experiment:

  1. In PhotoFlash, create a new document window, and paste a graphic into it.

  2. Switch into Frontier, create a new script window. Click on the Record button.

  3. Switch into PhotoFlash, rotate the picture by 90 degrees, then flip it on its vertical axis.

  4. Switch into Frontier, click on the Stop button.

Here's the script Frontier generated:

with objectModel, PhotoFlash 
   bringToFront ()
   rotate (document [1], by: 90.0)
   flip (document [1], vertically)

You can easily convert this to a script that applies the same operation to a folder of files:

local (f)
fileloop (f in "System:PhotoFlash Work:")
   with objectModel, PhotoFlash 
      open (f)
      rotate (document [1], by: 90.0)
      flip (document [1], vertically)
      close (document [1])

Recording AppleScript scripts works equally well in Frontier 3.0. Here's the first recorded script, with AppleScript selected as the scripting language:

tell Application "PhotoFlash"
   rotate document 1 by 90.0
   flip document 1 direction vertically
end tell

Rules & Strategies for Recording

  • The Record button is enabled only if the Macintosh Component Manager is present. If the Apple Event Manager isn't version 1.0.1 or newer, pressing the Record button generates the error: "A newer version of the Apple Event Manager is required for this operation."

  • The recording process captures all events that an application sends to itself that aren't explicitly excluded from recording. Frontier maps the events to valid UserTalk or AppleScript statements. The recorded statements include object specifications for the items that are manipulated, as well as a textual representation of any additional event parameters. You can think of the recording process as going into "object specifier discovery mode", saving trips to whatever documentation that might (or might not) be available for the application's scripting features.

  • Frontier uses a combination of information in the object database and the application's 'aete' resource to create script statements for the events it records. Event names are obtained from the 'aete'; if no name for a recorded event is found, or if there's no matching verb in the application's glue table, a low level appleEvent verb call is created.

  • When mapping object specifiers to text, Frontier uses the context of the objectModel table and the target application's verb table. If no matching name is found for a component of an object specification, the actual 4-character string value is used.

  • As mentioned earlier, in order for recording to work properly, you must have a current version of the install file for the application you are recording. Frontier can generate the install file for you.

© Copyright 1996-97 UserLand Software. This page was last built on 5/7/97; 1:42:25 PM. It was originally posted on 5/6/96; 9:12:02 PM. Internet service provided by Conxion.