Mac OS X supports AppleScript, JavaScript, Perl, PHP, Python, Ruby, various shell script dialects, and other popular scripting languages. Through scripting on Mac OS X you can invoke a launchd daemon, create a new Mail rule, change your iChat status, or run an Automator action. Developers can make their applications scriptable, enabling the automation of repetitive tasks and giving the user the ability to solve some problems on his own. To make automation even easier, Automator offers a simple drag-and-drop interface for users to create sophisticated workflows involving Mac OS X system services and both Apple and non-Apple applications. Scripting languages are often the ideal tool if you want to manipulate text, manage jobs, or link together disparate components without resorting to a compiled language like C++ or Objective-C. Scripting languages are a great tool for system administrators, application developers, and any user who needs to perform complex or repetitive tasks, because they were invented to solve these types of problems more quickly than can be done with general-purpose languages. Many Languages, Many UsesWeb content developers rely on JavaScript not only for creating web content but also for integrating application-like behavior into webpages, transforming them from static pages into dynamic environments. For example, you can use JavaScript in a browser to detect whether QuickTime is installed, then query and control the QuickTime plug-in directly. Ruby is a favorite open source technology for many developers, and it has recently gained a large following through the Ruby on Rails web application framework. Ruby on Rails gives you the advantage of rapidly creating great web applications backed by SQL databases to keep up with the speed of the Web. Python is a fully capable scripting language that also works well for application development, and it's included with Mac OS X. With Python, you can leverage the complete power and maturity of Cocoa to build uncompromising Mac OS X applications. AppleScript is Apple's powerful and versatile native language scripting technology for Mac OS X. AppleScript can control and communicate between applications, databases, networks, Web Services, and even the operating system itself. When you make your Mac OS X application scriptable, you empower your users to write scripts and automate operations they would rather not do themselves. Tying It All TogetherScripting Bridge, new in Leopard, brings advanced automation to the desktop, making it easy to send Apple Events—the built-in messaging architecture of Mac OS X—between applications, allowing you to leverage the features of rich desktop applications from your own code. The best part is that your code can be in the language you want, whether Objective-C (with Scripting Bridge), Python (with PyObjC), Ruby (with RubyCocoa), or pure AppleScript. The Automator application lets users without previous scripting experience automate tasks on their computer. Users link Automator actions—loadable code bundles that perform discrete tasks—together in a workflow. When the workflow executes, data is piped from one action to the next until the desired result is achieved. Many applications already support actions, and you can create your own actions using AppleScript, Objective-C, shell scripts or other scripting languages such as Perl and Python. Automator includes many features that make you productive immediately, such as starting points, a streamlined interface, the ability to use workflow variables to store and retrieve data, and UI recording and playback (through Automator's Watch Me Do technology). Plus, you can include the Automator frameworks in your application and put Automator to work for your users, all from within your application's user interface, allowing you to call on system services to burn a disc or tell Photo Booth to take a picture. Scripting and automation provide a powerful way to accomplish a multitude of tasks on Mac OS X, whether you are a system administrator, developer, or graphic artist. The availability of open source languages, as well as Apple's own AppleScript, means you can choose the best tool for the job. Automator allows you to setup the execution of workflow tasks using the same scripting languages, providing tremendous flexibility and the power to get the job done. If you are ready to begin learning about the APIs and tools available for Scripting & Automation, go to Getting Started with Scripting & Automation, for a guided introduction and learning path. For news, updates and links to other ADC content related to Scripting & Automation, return to the Scripting & Automation topic page. Updated: 2007-11-06 |