Skip to Content
Skip to Table of Contents

← Previous Article Next Article →

ATPM 6.03
March 2000



How To



Download ATPM 6.03

Choose a format:

Review: Player 1.5

by Michael Tsai,


Company: PreFab Software, Inc.



Price: $139 ($79 Academic)

Runtime Price: $25 each ($20 each for 10 or more)

For a long time, AppleScript was the Macintosh’s best-kept secret. The only problem was that no one wanted to keep it a secret—scripters and developers all benefit when more people start scripting. Thankfully, that’s just what has been happening over the last few years. Scripting with AppleScript is much easier than programming in a language like C or Java because AppleScript manages most of the nitty-gritty details for you. Scriptwriters can concentrate on the task at hand and perform high-level operations with ease. For this reason, AppleScript has become the automation tool of choice for Macintosh users who work with scriptable applications. But two obstacles stand in the way of more widespread use of AppleScript: (1) too many applications provide minimal support for scripting, or none at all, and (2) AppleScript’s English-like syntax makes it easy for novices to understand what a script does, but it can be confusing to master. Application dictionaries are great references for experienced AppleScript users, but novices have difficulty getting from dictionary definitions to working scripts.

Player, from PreFab Software, addresses both these problems. Normally, when you write an AppleScript, you look at an application’s dictionary to find the commands and objects that you’ll use. Then you try to figure out the syntax for combining them into something useful. If the application developer hasn’t created commands to control the relevant part of the application, then that part is off limits to your script. Indeed, I’m often faced with “scriptable” applications that aren’t sufficiently scriptable to do what I want.

Enter Player, which essentially acts like a player piano. The piano is your Mac, and the scripts you write are the rolls of paper tape. Player mimics keystrokes and mouse movements, and applications (scriptable or not) respond to them as if they came from you. Just tell Player what you would do to accomplish a task, and it will perform the steps for you. You can instruct Player to push buttons, choose items from menus, set and clear check boxes, and just about anything else you can think of. Your script can even inspect the properties of user interface elements (e.g., is a checkbox checked or a menu item selected?) and react accordingly.

Normal AppleScript dictionaries abstract operations (such as opening a file, resizing a graphic, or finding a database entry) from the steps that the user would take to accomplish the same task. With Player, the correspondence is direct, so the translation from “what I would do” to “what I should tell the script to do” is simple. If you can write the steps down in plain English, little extra work is required to translate them into Player’s command set. And once you learn Player’s commands, you can use them to control virtually any Mac application; there’s no need to learn new terminology for each one.

By now you might be thinking that Player is another utility along the lines of One Click, QuicKeys, or KeyQuencer. These macro utilities let you control applications more or less by telling them what you would do. But they have a different focus from Player, and for the automation freak both types of utilities are essential. Unlike Player, macro utilities provide palettes or keyboard shortcuts for executing macros. They generally have ready-made commands for controlling your Mac—changing the monitor resolution, switching between applications, and the like. By design, Player provides none of these; it focuses instead on letting you control your Mac from within AppleScripts. Some macro programs support a “do script” functionality that lets you embed commands in their languages inside your AppleScripts, but this is messy and error prone. Player’s solution is elegant: its commands are AppleScript commands.

What Exactly is Player?

Now that you know what Player does, it’s time to see what it is and how to use it. Player is a faceless background application and extension (in the same file) that runs whenever your Mac starts up. Like all scriptable applications, Player has a dictionary that lists the commands and objects that it supports.


What’s different about Player is that its verbs are for “playing” the user interface. Below is a sample script that uses Photoshop to convert the frontmost window to a GIF.


Notice that even though we’re controlling Photoshop, the tell statement is for PreFab Player. Player is “playing” Photoshop for us. The first line inside the tell checks to see if CMYK is checked in the Mode menu, demonstrating Player’s ability to inspect the state of the interface as well as change it. As you can see, writing commands in Player is intuitive. Like most of AppleScript, they read almost like plain English.

playerballoonThere are some cases, though, when it’s not so easy. Sometimes, Player can’t figure out the name of an interface element, so you have to refer to it by number or (failing that) pixel position in its window. To find out what these are, you can use Player’s novel balloon help feature. Switch on Player’s balloon help, and whenever you mouse over a button, pop-up menu, etc., a balloon pops up to tell you its type, name, number, and coordinates. If you require information about lots of items at once, you can use the outline dialog command to dump information about all the current window’s items into the Log window of your script editor.

Using Player

Player is a bit more difficult to learn than a macro program, but far more flexible. (And once you know what you’re doing, typing is quicker than entering statements through dialog boxes!) Because you talk to Player through tell statements, it’s easy to use Player in conjunction with other scriptable applications or OSAXen simply by embedding messages to it in your scripts. Rather than a new language (à la a macro program), I think of Player as an extension to AppleScript. You can control the flow of your Player scripts using AppleScript’s full range of looping constructs and handlers, and you can view its dictionary and write scripts for it using the AppleScript tools of your choice. It comes with a glue table for UserLand Frontier, which provides Frontier-style verbs for each command. In short, it plays well with the rest of your scripting arsenal.

Player’s commands are easy to learn and use. Unlike the dictionaries of some applications, Player’s dictionary genuinely feels like AppleScript. Also, PreFab has done some really elegant things with the commands themselves. For instance, the type command has an optional holding [holding <command | shift | option | control | caps lock>] argument. So one way to paste the clipboard is to say type "V" holding command.

You can also supply a list of keys to hold, so to print one copy of a document (in an application that supports such a command) you could write type "P" holding {command, shift} (where {command, shift} is a list literal). Here’s where the elegance comes in: since AppleScript’s concatenation operator is &, the above command can also be written as type "P" holding command & shift. Scripting doesn’t get much cleaner than that, folks.

Another cool feature is the click sequence command, which lets you specify a list of coordinates where the mouse should be clicked. You can do similar things with macro programs, but Player makes it elegant, both because it’s easy to enter the coordinates from the keyboard, and because you can easily calculate the coordinates at runtime, since they’re really just AppleScript lists.


Player’s internal workings, which are generally what make it such a pleasure to use, lead to a drawback. It’s slower than the macro programs, by far. The flip side is that I almost never have to insert delays to make my scripts work properly, as I always had to do with QuicKeys. Another problem is that in some applications (like BBEdit), the balloon help feature doesn’t work properly; the balloons flicker so fast that I can’t read them. Finally, Player doesn’t have a record mode, so you have to create all your scripts by hand.

Also, buying Player is more difficult than it should be. It’s apparently only available direct from PreFab Software, and although they support several methods of payment, a secure online order form isn’t one of them. I would mention that the price is steep for a utility in Player’s class, except that I don’t know of any other utilities that can do what Player does. So I’ll simply say that it’s expensive compared to macro programs, but worth every penny if you’re a serious AppleScripter (or UserTalker).


Player is a great little utility. It uses about 300K of RAM and less than 200K of disk space. Unlike some of the macro utilities, it hasn’t made my Mac unstable. It comes with a free copy of the Player Runtime, which lets you run scripts (but not edit them) on a second machine. Additional copies of the Runtime are available, and are much cheaper than the developer version. A free trial of Player is available from PreFab Software’s Web site. Although I’ve used Player to automate many little tasks, such as entering meta information in the PDF edition of ATPM, large-scale repetitive tasks are where it really shines. When I had to automate the processing of several thousand Excel graphs, Player let me control parts of Excel that its AppleScript dictionary doesn’t expose. With Player controlling two G3 Macs, the project took about a week of solid processing time. But Player was doing the grungy work, not me. I’m sure other Player users have similar success stories.

appleCopyright ©2000 Michael Tsai, Reviewing in ATPM is open to anyone. If you’re interested, write to us at

Reader Comments (0)

Add A Comment

 E-mail me new comments on this article