Web DevCenter
oreilly.comSafari Books Online.Conferences.
MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA

Sponsored Developer Resources

Web Columns
Adobe GoLive
Essential JavaScript

Web Topics
All Articles
Scripting Languages

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed

Learning Lab

JavaScript and Mac OS

by Richard Hough

Most Mac Hackers are well aware of AppleScript. What most are not aware of is that AppleScript is merely one implementation of Apple's Mac OS Open Scripting Architecture, or OSA. Mac OS comes pre-installed with AppleScript, but there is at least one other OSA language available: JavaScript.

Late Night Software, a company that makes AppleScript tools, has ported the Mozilla JavaScript 1.5 interpreter as an OSA component. Installing it will allow you to use JavaScript on Mac OS wherever you could use AppleScript. Here are a few reasons you might want to do this:

  • JavaScript has several features that AppleScript lacks, such as associative arrays and regular expressions.

  • JavaScript is available on other operating systems while AppleScript is not, so you can share JavaScript code and expertise between different platforms.

  • There is considerably more documentation and sample code available for JavaScript than AppleScript.

  • It's fun!

Comment on this article Have you used JavaScript in the OSA environment? We'd love to hear about your experiences..

To run JavaScript from Mac OS, you must first download the OSA component from Late Night Software's JavaScript OSA page. The web page includes instructions for installing the JavaScript OSA on Mac OS 8, 9, and X. After you have installed it, launch the Apple Script Editor application and choose "JavaScript" from the language menu in the bottom left of the Script Editor window.

Pages: 1, 2, 3

Next Pagearrow