<
 

Running AppleScripts in iTunes

 

When iTunes 2 introduced a Scripts Menu in the Menu Bar to launch AppleScripts, you wouldn't have known it at first glance. That's because you had to set it up. You may still have to. Here's how:

OS X: For single Users, make a "Scripts" folder in the Users > username > Library > iTunes folder. Put your scripts in the "Scripts" folder and they will appear in iTunes' Scripts Menu.

To make AppleScripts available to all Users, create a folder called "Scripts" and place it in Library > iTunes (you may have to create the "iTunes" folder; I think you can put the "iTunes Plug-Ins" folder here also).

OS 9: Create a folder called "Scripts" and place it in the same folder with the iTunes application. AppleScripts placed here will show up in the Scripts Menu.

You can also create a "Scripts" folder in your Documents > iTunes folder. This is considered the "per-user" folder while the one in the iTunes application folder is global to all users.

You can organize your scripts to some degree by placing them in folders inside your Scripts folder. This will help you in the Finder; the Scripts will still appear in one long list in iTunes' Scripts Menu. (Some other attachable applications let you use sub-folders which create a sub-menu heirarchy—hint hint, Apple!) I am not aware of any maximum limit on the number of scripts you can put in your Scripts folders. As of this writing, I have 288 that I use regularly or that I am working on.

Users of Mac OS 10.3 and higher can assign keyboard shortcuts to AppleScripts in iTunes Scripts Menu. This is a very cool innovation!

Another way of accessing scripts is with some sort of launcher. OS X has the dandy Script Menu pre-installed now, which let's you run compiled scripts System-wide from a drop down menu in the Menu Bar. You add scripts to the Scripts Menu by putting them in Library > Scripts for all users or Users > username > Library > Scripts for individual users.

You can load AppleScript applets into the Finder's toolbar by drag and drop. There are also some applications that allow you to launch applets from the Dock. In OS 9, the Launcher, DragThing, FinderPop, TaskMenuBar and other similar utilities can be loaded with AppleScript applications—"applets". If you want to run compiled scripts from the OS 9 Menu Bar use Leonard Rosenthal's "OSA Menu" from your original OS 9 CD or from Leonard Rosenthol's Lazerware Site.

Being able to access and activate scripts won't do you any good if AppleScript isn't installed. In OS 9, you should have an AppleScript Extension and a Scripting Additions folder in the System Folder. The Script Editor, which helps you write scripts, is located in the Applications > Apple Extras > AppleScript folder.

AppleScripting components are automatically installed by OS X, so unless you've gone and done something crazy, AppleScripting under OS X should be all set. Script Editor is in Applications > AppleScript. You probably shouldn't disturb other components.

The AppleScripting architecture of iTunes for OS 9 and OS X are similar enough so scripts written for one should work for both OSs through iTunes 2. However, you will discover that there are small differences between them by virtue of each Operating System. Of course, versions of iTunes 3 and higher aren't even available for OS 9 and many of the more recent scripts may not even work with iTunes 2 in OS 9. Although, as more people adopt OS X and as OS 9 goes the way of SoundJam, this will become less of an issue.

Finally, if you aren't sure what a script is supposed to do don't use it.

updated oct 29 '03

This column is printer-friendly.
home | scripts | tips & info | forum at iLounge | rssfeed rss
Site contents © 2001 - 2008 Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. All rights reserved. Legal.
AppleScript, iTunes, and iPod are registered trademarks of Apple Inc.
This page was served using PHP. Be that as it may—whatever that means—this page was last modified by human hands on November 10, 2005.

"Bad facts make bad laws." - F. Zappa