Previous Issue | Search TidBITS | TidBITS Home Page | Next Issue
Mac OS X traded stability for flexibility by removing the system-level hooks that enabled utilities like QuicKeys to automate nearly anything. That flexibility has now returned in Jaguar, and Matt Neuburg explains how you can use it right now with only AppleScript! Also this week, Glenn Fleishman looks at network storage devices that don't require a computer, and we note the releases of Keynote 1.0.1, iMovie 3.0.2, and Security Update 2003-03-03.
Copyright 2003 TidBITS Electronic Publishing. All rights reserved.
Information: <firstname.lastname@example.org> Comments: <email@example.com>
This issue of TidBITS sponsored in part by:
Make friends and influence people by sponsoring TidBITS!
Put your company and products in front of tens of thousands of
savvy, committed Macintosh users who actually buy stuff.
For more information and rates, email <firstname.lastname@example.org>.
READERS LIKE YOU! Help keep TidBITS going via our voluntary
contribution program. Special thanks this week to Erik Carlson
and Prospect Hill Publishing Services for their kind support!
SMALL DOG ELECTRONICS: G4 800 MHz iMacs with AppleCare
iMac G4/800 15-inch 256/60/SuperDrive/Speakers
Plus AppleCare - Limited Quantities! $1,429!
Visit: <http://www.smalldog.com/tb/> 802-496-7171
SIX DEGREES puts your email back to work for you. It eliminates
the need to refile email or search for that elusive message.
Your email isn't going away, so you may as well put it to work.
Bare Bones Software TextWrangler 1.0 -- New general-purpose and
richly featured tool for composing, modifying, and transforming
text stored in plain-text files. For more info, to download a
demo, or to purchase: <http://www.barebones.com/>
Java 1.4.1 Update -- Late this afternoon, Apple released Java 1.4.1, a significant update to the Java environment on the Mac. According to Apple, Java support in Safari and other Web browsers that support the Java Internet Plug-in has been improved, and applications written in Java now better take advantage of the Aqua interface and Quartz Extreme rendering capabilities in Mac OS X. This release also marks parity with the latest release of Sun's Java, with built-in support for XML-based Web services and better stability. Java applications can implement Jaguar's Universal Access features, including the capability to control Java applications with AppleScript using Apple's new UI Scripting technology (see Matt Neuburg's article "Scripting the Unscriptable in Mac OS X" later in this issue). Java 1.4.1 is a 26.1 MB download. [JLC]
Keynote 1.0.1 Update -- Apple released Keynote 1.0.1 via Software Update, saying that the new version brings support for Japanese, French, German, Dutch, Italian, and Spanish to the presentation software. However, I was also able to confirm with Apple that Keynote 1.0.1 fixes a few unspecified bugs, making it a worthwhile download even for those who need only the English support. A few notes: on my iBook, which has relatively little free disk space, I was warned that Keynote works best with 1 GB of free disk space; although the Keynote box does make that clear as well, it came as a surprise to me. Also, Keynote must be installed on your startup volume. Keynote 1.0.1 is a 9 MB download. [ACE]
Security Update 2003-03-03 -- In an effort to stay up to date with security improvements on the Unix front, Apple has also released Security Update 2003-03-03, which provides a new version of sendmail that closes a hole which could allow a cracker access to the system. It wasn't a serious problem for most Mac users, since sendmail is off by default. Also updated was OpenSSL, the new version of which provides improved data confidentiality. Since the sendmail problem affects Mac OS X 10.1.5 as well as 10.2.4, there's a variant of the update for those Mac OS X users who haven't updated to Jaguar. The Jaguar version of the update is a 1.7 MB download; the 10.1.5 version is a 705K download. [ACE]
iMovie 3.0.2 Update -- Apple's pest control department also released a maintenance update to iMovie 3, incorporating unspecified bug fixes into the promising, but troubled, video-editing application (see "iMovie, Take 3" in TidBITS-665). Although Apple has not released details of what has changed in version 3.0.2, playback performance has improved and the application feels a little snappier than earlier versions (though nowhere near the performance of iMovie 2). Online reports indicate that iMovie 3.0.2 continues to suffer audio synchronization problems and has issues with exporting movies back to tape. It's also worth noting that the Ken Burns Effect (pan and zoom) is still applied to every imported still photo by default, something which may be a feature but which acts like a bug. However, in iMovie 3.0.2 you can set the Zoom level for the Start and Finish points to 1.00 (the minimum value) before dragging an image from the Photos pane, and iMovie will treat the image as a still instead of a rendered movie clip.
The iMovie 3.0.2 update is available via Software Update or as a separate 1.9 MB download. Note that the updater looks for the application "iMovie" in the Applications folder; if you've moved or renamed the program, the updater will not work. I highly recommend copying your existing iMovie application to a separate drive before running the update, and it's also a good idea to use Apple's Disk Utility to repair privileges on your startup disk after the update is applied. [JLC]
by Glenn Fleishman <email@example.com>
Setting up an old Mac as a network fileserver has been a trivial operation since the release of System 7 many years ago: create a few sharing accounts, set permissions on folders, turn file sharing on, and you're done.
Many of us have older Macs lying around that can be put into service as a file server with a larger hard drive and the latest Mac OS version the computer can handle. Or, we may already have an old tower or laptop acting as our central storage facility.
But when you're starting from scratch or trying to plan a mixed Windows/Mac/Linux network, you might be able to avoid the cost and time to set up yet another computer with network-attached storage (NAS), a several-year-old concept that's finally trickling down to an affordable level.
The concept of NAS is that you're essentially plugging a hard drive into an Ethernet network: no computer, no monitor, no keyboard. Administration, such as adding users or running other operations, happens either through a special piece of software, or, more commonly, a Web browser pointing at that device (which runs a small Web server, like so many network devices these days).
A network-attached storage device has the benefit of simplicity and cost: you can't buy a used Mac with the same hard drive storage and Windows/Linux file-serving compatibility as cheaply as the low-end NAS units, and running a headless Mac (with no monitor or keyboard) can be frustrating even with remote control software like Timbuktu or VNC.
Linksys EtherFast Instant GigaDrive -- I recently had the opportunity to evaluate the Linksys EtherFast Instant GigaDrive, an 80 GB NAS unit that offers Windows-style SMB file sharing (supported in Mac OS X 10.2 Jaguar or with Thursby's Dave in Mac OS 9, and under most Linux flavors), FTP upload and download, and Web-based download.
The Instant GigaDrive sports a single 10/100 Mbps Ethernet port, a parallel port for Windows-style print sharing, and two removable drive bays. Although the Instant GigaDrive comes with a single 80 GB drive installed in one bay, you can replace it or add a second drive up to 120 GB.
The Instant GigaDrive offers printer sharing via the Internet Printing Protocol (IPP), which should be compatible with the CUPS printing support built into Jaguar. However, no matter what I tried, I was unable to get a Mac OS X 10.2 system to connect to it. The IPP and CUPS documentation on the Web is scanty, although it's possible that the open source Gimp-Print drivers would have helped.
The Instant GigaDrive's biggest downside is price: $500 on the street. But when you break out the different features packed into a single piece of hardware and factor in the ease of setup and administration, you'd be hard pressed to find the same deal without enduring many hours of work and paying as much or more money for initial setup. I looked up a few Linux system resellers, and found a similarly equipped PC with no monitor, an 80 GB hard drive, and Linux preinstalled for just under $500. Likewise, although you can get similar full Windows systems for about $500, you must still attach a monitor or remote control software, protect them (no easy task), and otherwise maintain the overall system.
Internally, the Instant GigaDrive is a model of simplicity, relying at its core on a Linux system that resides on a 16 MB Compact Flash card. If your unit or drives go south, you can remove the card, pop it into a replacement unit, and retain all your custom settings, users, groups, and other parameters.
If you add a second drive, you can set the Instant GigaDrive to dump the entire contents of one drive to the other on a regular basis for a simple backup. Or, if you prefer, you can just use the second drive for even more network storage.
As with all Linksys products, the unit pretends to require a Windows-based PC for configuration by supplying only a special PC program with a single major function: to find the Instant GigaDrive's default network number and access it even if you're not on the same "private" network. At the time, I didn't have a Windows box handy, which meant I had to take a short detour to create a private network range.
Adding a Private Linksys Network Range -- Like all Linksys products, the Instant GigaDrive comes preset to an IP address in the 192.168.1.0 network. If your local network uses static IP addresses or you're using a DHCP server that feeds out private addresses in another range, you can reset the Instant GigaDrive's address by switching your Mac temporarily to the 192.168.1.0 network, making the change, and switching back to your preferred network range. This procedure works only with a wired connection (not wireless), and may temporarily disrupt your computer's network connection, so be sure to unmount file servers.
In Mac OS 9 and earlier, bring up the TCP/IP control panel, select Configurations from the File menu, and Duplicate your basic configuration. Select the duplicate and rename it to "Private 192.168.1.0" or something similar. Select Ethernet from the Connect via pop-up menu, then select Manually from the Configure pop-up menu. Enter 192.168.1.99 as the IP address. Set the subnet mask to 255.255.255.0. You can leave the Router address field blank or enter 192.168.1.1. Quit and click Make Changes in the confirmation dialog.
In Mac OS X, open the Network preferences pane in System Preferences. Choose Network Port Configurations from the Show menu. Select Built-in Ethernet and click Duplicate. You can rename that entry "Private 192.168.1.0". Select that entry from the Show menu and click the TCP/IP tab. Choose Manually from the Configure pop-up menu. Enter 192.168.1.99 as the IP address. Set the Subnet Mask to 255.255.255.0. You can leave the Router field blank or enter 192.168.1.1. Click Apply Now.
As I noted before, all Linksys gateways and network products default to a private network address in the 192.168.1.0 range. The Instant GigaDrive's IP number is 192.168.1.77. Enter that number in a Web browser and you'll see the Instant GigaDrive's configuration screen. The default username is "administrator" - all lower-case, not with a capital A as shown in the manual - and there's no password.
Attaching that Storage -- To use the Instant GigaDrive, you set up users and groups, each of which can have an overall storage allocation. I first set up my account "glennf" with a 1 GB limit. I then mounted the drive in Jaguar by entering "smb://192.168.1.77" (see above) in the Connect to Server dialog, selecting my "glennf" volume, and providing my user name and password when prompted. The Instant GigaDrive partition appeared on my Desktop as a volume with a gigabyte available.
Several configuration options let you set automatic diagnostics so the Instant GigaDrive defragments itself or runs a disk check every night. The unit supports S.M.A.R.T. disks, which are hard drives that have built-in self-monitoring hardware and software and that can report problems before they happen. The Instant GigaDrive can even email you with various kinds of reports and warnings.
Although the Instant GigaDrive isn't for every network, especially those in which the cheap old Mac still suffices, it's a simple way for someone not trained as a system administrator to run a reliable file server without the overhead of maintaining an entire operating system.
PayBITS: Are you now looking into adding some network storage?
Consider supporting Glenn with a few bucks via PayPal!
Read more about PayBITS: <http://www.tidbits.com/paybits/>
by Matt Neuburg <firstname.lastname@example.org>
This is the tale of a U.S. government statute, a certain Cupertino-based computer company, and a small revolution taking place quietly on your computer, if you use Mac OS X 10.2 Jaguar.
To understand this revolution, you need to know what a macro program is. I've been writing in TidBITS about such programs for years. Simply put, there are certain frequent or repetitive computer tasks that one would like to be able to automate. This is often straightforward if the program that performs these tasks is scriptable, meaning that it responds to a repertory of AppleScript commands: you just write a script expressing what you want done. But what if the program is not scriptable?
Of Macs and Macros, Take Two -- One solution that worked pretty well for me in previous incarnations of the Mac OS was to use a macro program. Such a program must hack into the Mac OS itself so as to be able to simulate the presence of a "ghost" user who can press keys and move and click the mouse just as a real user would. By stringing together such actions, the computer could sometimes be forced to make up for the lack of scriptability in certain applications. Macro programs that I formerly used include PreFab Player, QuicKeys, OneClick, and KeyQuencer.
Now wind the clock forward to Mac OS X. The trouble here is the word "hack" in the previous paragraph. One of the main points of Mac OS X is that you can't hack the operating system; to preserve stability, Apple has abolished the kind of extensions that used to make such hacks possible. Unfortunately, this means that macro programs don't work all that well on Mac OS X. When QuicKeys was migrated to Mac OS X, I was appalled how poorly it worked. It had trouble performing certain kinds of actions, such as choosing from menus and pushing buttons; and, more important, it couldn't "see" what menu items and buttons were present, so it couldn't make intelligent decisions or wait for the right window to appear.
These limitations, of course, were not the fault of QuicKeys. Since QuicKeys couldn't hack into Mac OS X, it could see and act only in ways permitted to it by the various legitimate application programming interfaces (APIs) provided by Apple. And Apple, concerned with stability, wasn't about to let just any old program reach in and start meddling with some other program's windows and menus. Knowing this, however, did not solve the problem; and users were left staring at QuicKeys, waiting for it to improve. It did; but not much.
Now for the revolution. While we were all staring the wrong way - at QuicKeys - the problem was being solved by Apple itself. And the solution (in general, and for future versions of QuicKeys as well) is in place, right now. You can script unscriptable applications, manipulating their menus and windows and buttons, and typing text, right now. It's just that Apple hasn't bothered to say much about it, so few people know.
Enter Uncle Sam -- How could this happen? And why did it happen? It all goes back to a U.S. statute called the Workforce Investment Act of 1998, commonly known as Section 508. This statute says that when federal agencies procure electronic information technology, that technology must give disabled people access to information that's comparable to the access it gives non-disabled people. In plain English, if you manufacture computers, and you want any government agency to be able to buy any of them, they must be fully operable by people with disabilities.
To see what this statute might mean for Apple Computer, Inc., let's put ourselves inside the mind of someone at Apple Computer, Inc. This person is imagining a Mac being operated by someone with a disability. And he or she is thinking: "Suppose this disability is such that the user can't work with the keyboard or the mouse. Holy cow! Unless we want our government sales to be zero, we'd better provide a way, in Mac OS X, for some other device, such as one of those sip-and-puff joysticks, to be able to operate all parts of the user interface." Clearly such operation implies something far beyond merely a few keyboard shortcuts that substitute for the mouse some of the time, as in the Universal Access and Keyboard preferences panes. It means that the system itself must be able to "see" and access all the individual interface elements of any application, so as to provide a pathway whereby a joystick, or any other assistive device, can press every button and click in every text box and somehow reach every interface element that appears on the screen.
The idea, then, is this. Given any application on Mac OS X, it needs to be possible for some other application to discover what interface elements it is displaying. The other application needs to be able to "read" these elements ("There's a button that says OK") and it needs to be able to access them (click the OK button). Apple went to work on the problem, and the result, which first emerged to public view in Jaguar, is the Accessibility API. Actually, there are two things going on. Under the surface, Apple has provided some deep magic, in the operating system itself, that does the reading and the accessing of all the interface elements present on the screen. Closer to the surface, Apple has provided the API, which is a set of commands a programmer can use to take advantage of this magic.
Now stop and think about what I just said. This is all present in Jaguar, right now. So anyone can write a program that can see and access the interface elements of any other program, right now. But such a program would, in effect, be a macro program! In short, the various things QuicKeys couldn't do when it first appeared on Mac OS X, because it couldn't hack into the Mac OS, any program can now do, thanks to the Accessibility API.
But it gets better. Read on.
Blessed (System) Events -- At some point, someone at Apple put two and two together, as follows. "On the one hand, we've got the Accessibility API, which lets any program access the interface elements of any other program. On the other hand, we've got AppleScript, which lets any user write a script to give commands to any scriptable program. So what would happen if we put them together? Any user would be able to write a script to give commands to a scriptable program which would use the Accessibility API to access the interface elements of any program." To see the significance of this, just take out the middle terms, and what have you got? Any user can write a script that can access the interface elements of any program. Any user can script an unscriptable program, using AppleScript! You wouldn't need any special macro program, because AppleScript itself, which is already on your computer, would become a macro language.
Of course, for this to work, there has to be that "middle term" - the go-between, the application that receives AppleScript commands and talks to the Accessibility API. That application is called System Events. It's on your computer right now, in /System/Library/Core Services. But the version of System Events that knows about the Accessibility API is probably not on your computer, because it's in beta and is not part of the standard Mac OS X release. You must download and install it separately, from Apple's GUI Scripting Web page.
Let's try it out! There are two preliminary steps.
Download and install the beta version of System Events.
In the Universal Access preferences pane, check the box at the bottom that says "Enable access for assistive devices." This is crucial because it throws the virtual switch that brings the Accessibility API into play.
We'll also need an unscriptable application to operate on. For this example, we'll use my own freeware MemoryStick, so download it (and shame on you) if you haven't got it.
MemoryStick isn't scriptable, and was never intended to be. Nevertheless, as if by magic, we're going to open its Preferences window, find the Poll tab item, read how often MemoryStick is set to poll the system, and click the spinner up or down the right number of times so that the setting ends up at "5 seconds" - and then close the Preferences window. Ready?
Start up MemoryStick if it isn't running. Start up Script Editor (it's in /Applications/AppleScript). Paste in the following script:
tell application "MemoryStick" to activate tell application "System Events" tell application process "MemoryStick" click menu item "Preferences..." of menu "MemoryStick" of menu bar 1 tell tab group 1 of window "MemoryStick Preferences" click radio button "Poll" get value of static text 3 copy the result as number to theVal set theDec to theVal - 5 if theDec > 0 then repeat theDec times decrement incrementor 1 end repeat else if theDec < 0 then set theDec to 0 - theDec repeat theDec times increment incrementor 1 end repeat end if end tell click button "Done" of window "MemoryStick Preferences" end tell end tell
Now run the script, and watch the fun. Don't blink, or you'll miss it!
Future Directions -- By now, you're probably saying, "Wow! That was great! How can I learn to give these sorts of commands to any application, so that I can script unscriptable applications and turn AppleScript into a macro programming language?"
Luckily, there's a splendid way to do this. It's called PreFab UI Browser, the work of Scott Lawton of PreFab Software, who brought us PreFab Player and TextMachine, and Bill Cheeseman, the well-known AppleScript guru and author of Cocoa Recipes for Mac OS X. This brilliant little program uses the Accessibility API to "look" at all the interface elements of any running application, and generates the AppleScript commands you'd use to click them, read them, type into them, or whatever. It's $25 (until mid-April, when the price goes up), and a 30-day demo is available.
It will be interesting to see what further applications will emerge that take advantage of the Accessibility API. For example, one of my favorite utilities in earlier days was an extension that listed all the windows in all running applications, so that you could switch directly to the right window, no matter what application you were in now. Before the Accessibility API, such a utility was impossible in Mac OS X, because no application could "see" another application's windows, let alone switch amongst them - the Dock could do it, but only because it belonged to Apple and was privy to System-level secrets no one else had. But now, writing such a utility should be easy.
The story is not over, not least because both the Accessibility API and the Scripting Events beta are still young, still in development, and still buggy. Nevertheless, they do work, as the example proves; and eventually, perhaps as part of the next major update to Mac OS X, I would expect the special version of System Events to come out of beta and be made part of the standard release. Meanwhile, now that you know the secret, you can start playing with AppleScript in its wonderful new role as a macro language on Mac OS X.
As you do, keep in mind that even the Accessibility API can't perform miracles; it can't detect interface items that are not constructed by way of Mac OS X's built-in toolbox. A program that uses non-standard interface items can be written deliberately to provide Accessibility API access to them; but if it isn't, the Accessibility API is blind. For example, the Accessibility API can't see any of Microsoft Word's menus, toolbars, or even the text of a document.
Not that this matters, of course, because Microsoft Word is completely scriptable already. Which raises another point: There's no substitute for true scriptability. To write an application of any serious power without giving it the ability to be driven with AppleScript is simply poor programming practice. So, if you're able to automate some previously unscriptable area of your workflow through Accessibility API scripting, that's splendid; but if the target program is still being actively developed, please do also write to the developers and ask that they make that same functionality genuinely scriptable.
PayBITS: If Matt's article makes a difference for what you
can script, consider sending him a few bucks via PayPal!
Read more about PayBITS: <http://www.tidbits.com/paybits/>
Non-profit, non-commercial publications and Web sites may reprint or link to articles if full credit is given. Others please contact us. We do not guarantee accuracy of articles. Caveat lector. Publication, product, and company names may be registered trademarks of their companies. TidBITS ISSN 1090-7017.
Previous Issue | Search TidBITS | TidBITS Home Page | Next Issue