Thoughtful, detailed coverage of the Mac, iPhone, and iPad, plus the TidBITS Content Network for Apple consultants.

Frontier Justice

As for back as November of 1992 (see TidBITS-153 and TidBITS-154), TidBITS has been talking about Frontier, UserLand Software's system-level scripting environment for the Mac. It's commonly described as "AppleScript on steroids," or "AppleScript done right," but neither summary does it justice. Frontier is an OSA-compliant scripting system with a number of unique features that (in most cases) make it both more powerful and more robust than AppleScript. Frontier has also been around longer than AppleScript: Frontier was a real, working, shipping product when AppleScript was only much-touted vaporware from Apple.

If Frontier has a longer track record and offers more power, why doesn't everyone using Frontier instead of AppleScript? There are a number of reasons. First, Frontier's knowledge requirement: whereas QuicKeys and HyperTalk are relatively accessible to sophisticated Macintosh users, UserTalk (Frontier's scripting language) isn't for the faint of heart: essentially, in-depth use of Frontier requires some programming experience. Second, AppleScript: these days, Apple's own scripting system ships with System 7.5 and is widely available in other channels. Why bother with Frontier - even if it offers more power - when a "reasonable" solution is already on hand and supported by Apple? Third, until recently, Frontier had a price tag attached: to develop custom solutions using Frontier, it usually cost you over $200 to get in the game. Although Frontier was a powerful package with a devoted group of users (and Frontier Runtime made distributing Frontier scripts easier), clearly the "adoption threshold" for Frontier limited its audience.

So, Dave Winer and the folks at UserLand decided to eliminate reason number three: With release 4.0 - code named Aretha - Frontier will be available for free. And what's more, the new Frontier is setting its sights on the Internet and online publishing. The first public beta of Aretha is available on UserLand's Web site at HotWired; expect more betas (and more net-specific features) in the coming weeks:


In short: if you run a Macintosh-based Web server or need to extract custom capabilities from your Internet applications, Aretha might rock your world.

The Object Database -- On the surface, Aretha is not much different from the currently-shipping version of Frontier. (In fact, the core application and kernel of Aretha is identical to Frontier 3.0.3.) What's changed, then? One of Frontier's unique (and most useful) features is called the Object Database. Basically, the Object Database is a hierarchical, disk-based storage system for handling objects Frontier knows about. Those objects can be data (strings, outlines, a chunk of word-processing text, a menubar, raw binary data, and so on), and they can be scripts. These objects are stored in tables, and (of course) tables can contain still more tables, so objects can be organized in whatever manner most meets your needs. Because Frontier is OSA-compliant, the Object Database can store and manage scripts in UserTalk as well as other OSA languages you might have installed (such as AppleScript, QuicKeys, or - keep your fingers crossed! - MacPerl).

The power behind the Object Database is simple: everything is stored in one place, it's persistent between Frontier sessions, and it's much faster than storing all these objects as separate files in the Finder. This lets your scripts communicate with each other and share information very easily; it also encourages you to leverage work from other scripts and solve problems in small, reusable chunks. In fact, one of the neatest things about the Object Database is that UserLand ships it with a bunch of useful scripts already installed: these not only serve as examples of how to write Frontier scripts, but also how to re-use code.

Scripting the Net -- Though the Frontier application may be the same as in the previous release, the Object Database in Aretha contains a number of scripts and utilities specific to using Frontier in conjunction with Internet applications like Netscape, Eudora, Anarchie, and WebSTAR (formerly known as MacHTTP). In future betas, you can expect these built-in utilities to expand considerably. You may be thinking that all these applications can be tied together with AppleScript, and you're right. But it's only in observing the power and utility Frontier brings to the equation that you start to understand what UserLand is thinking. For example:

  • WebWorm: The idea of a writing a worm for the World-Wide Web is not a new one (and it's not insidious - what do you think WebCrawler and Lycos are at heart?). The basic idea is this: point the worm at a Web page and it follows and catalogs every link it finds, essentially recording a tree of everywhere that particular page leads. The Web is too big and changes too fast for it to be fully cataloged by worms, but that doesn't mean they aren't useful utilities. I tried to write a Web worm using AppleScript a few months ago: let's just say I met with mixed success. Aretha has a basic Web worm built in that works in conjunction with Netscape 1.1N.

  • CGI Scripts: CGI stands for Common Gateway Interface, and it lets a Web server execute custom commands based on user input (for instance, via a form or a button on a Web page). The programs the server executes are called CGI scripts. On a Unix system, they're often written in Perl (a language with strong text-handling capabilities). On the Mac, WebSTAR (and MacHTTP) support CGIs via AppleScript. Starting with beta 1 of Aretha, WebSTAR can have Frontier handle its CGIs. This doesn't mean rewriting any AppleScript CGI's you're already using - after all, Frontier handles AppleScript just fine. But using Frontier gives you more speed and flexibility, and (perhaps most importantly), you can use the Object Database to store information for your scripts.

  • AutoWeb: The first beta of Aretha focuses almost exclusively on WebSTAR, but as future versions of Aretha tie directly into more Internet applications, the possibilities increase significantly. One good example of how these potentials might play out is AutoWeb, originally conceived as a separate product but now rolled into Aretha. AutoWeb is a tool to build and manage entire Web sites from a hierarchical set of folders and text and graphics files. You need only to look at UserLand's pages on HotWired to see the intent of AutoWeb. Note the consistency across the pages, the Next, Previous, and Home links, timestamps, and copyright info. AutoWeb also helps with generating anchors and links, plus managing the plethora of text and graphic files that inevitably make any significant Web site look like an escapee from a lost sectors convention. Before you say you're unimpressed, the point isn't that the elements on UserLand's pages are revolutionary, but that they're automatically managed and hassle-free.

http://www.hotwired.com/Staff/userland/aretha/ autoweb_234.html

Scripting You -- One of the most intriguing - and most controversial - aspects of Aretha's current integration with Netscape is the ability to embed Frontier scripts within a Web page. This sort of thing has been possible with AppleScript, although not exactly commonplace. However, if you're running Netscape 1.1N and have Aretha running at the same time, clicking a URL like this embedded in a Web page:

<a href="usrtlk:dialog.alert%20(%22Guess%20who?%22)">click this</a>

tells Aretha to display a dialog saying "Guess who?" on your screen. You'll notice the "usrtlk:" protocol tag at the beginning of the anchor: this tells Netscape to pass the URL along to the UserTalk language interpreter built into Frontier. (If Frontier isn't running, the URL generates a standard Netscape error.)

The implications of this idea are promising. The ability to execute script fragments on the client machine via the Web allows considerable custom functionality to be integrated into a Web site, almost regardless of the speed of the connection between the host and the client. It also lends itself to the new "hybrid" online-and-on-disk products that are beginning to appear. Suddenly a Web client can become an interface to a custom application with considerable functionality. With an scriptable application, interactive online tutorials and support via the World-Wide Web are suddenly a very real possibility. And just think what those crazy game developers could do...

Security -- Some TidBITS readers will notice parallels between Aretha's ability to execute scripts on a client's machine and portions of Java, the language built into Sun Microsystems' Web browser, HotJava. Sun and Netscape recently announced plans to integrate the Java language into Netscape's browsers.


One of the issues surrounding the execution of scripts on a client machine via the World-Wide Web is security. In the "usrtlk:" URL given above, it wouldn't take much more code to delete files or shut down your machine than it does to display that dialog. At the present time, Aretha has no security features built into it: if I created such a URL and you loaded it, you're at my mercy.

At the present time, the lack of security features is deliberate, although UserLand is very much aware of the issue and plans to roll security into future releases. (It might be noted that there are no security features built into AppleScript for this sort of implementation, either.) The issues surrounding security in script execution are complex and UserLand prefers to wait a bit and do it right, rather than do it wrong and shoot Aretha (and themselves) in the foot.

Support and the Price of Freedom -- Make no mistake: Aretha isn't any more accessible to the average Mac user than Frontier was. However, UserLand has correctly realized that the real audience for a tool like Frontier isn't necessarily in the general population of Macintosh users, but in the subset that have to manage complex tasks and provide custom solutions across a number of applications. Given the Mac's popularity both as an Internet client and a server and Aretha's focus on the world of the Internet and the Web, Frontier may have finally found a niche where it can do more than flourish. By being freely available, Aretha also has a chance to set the standard for scriptability on the Mac and on the Internet.

UserLand has committed to participating and supporting Aretha through the Mac Scripting list at Dartmouth. Check it out for discussion of issues and features of Aretha.

http://mmm.dartmouth.edu/pages/macscripting/ macscripting-home.html

Information from:
UserLand Software


Fujitsu ScanSnap Scanners — Save your business time and money
with our easy-to-use small ScanSnap Scanner line. Eliminate
paper piles by scanning documents, business cards, and receipts.
Visit us at: <http://budurl.me/sstb>