Archive for the ‘AppleScript Editor’ Category

As you may know: to run AppleScripts that were compiled on a PowerPC machine on Intel machines (and therefore Snow Leopard) requires Rosetta—an optional install on your SL install disc. While Rosetta is a fairly small install, some people have expressed an interest in staying Rosetta-free. There are quite a few of these types of AppleScripts here on the site and I’m working on updating them to Universal Binary (although a good percentage of these in the Retro Scripts category probably won’t be updated by virtue of being obsolete). Long-time visitors may also have some of these scripts in their collections.

While you could wait for me to update these kinds of scripts to UB—disclosure: one of these days I will get around to admitting that I am a notorious procrastinator—you can update these scripts yourself by doing what I would do: open the script in AppleScript Editor, noting whether it is a compiled Script (.scpt) or an Application (.app), and re-save it. It will be re-compiled for your machine type, and if it is an Intel machine, will run without Rosetta. The “Run Only” and “Startup Screen” checkboxes can be left unchecked. Script Applications that use idle handlers need to be checked “Stay Open”.

During the Save, if AppleScript Editor informs you that the “Document Format is Read Only: This script application is in a format that is no longer supported…”, the case for non-bundled applications compiled pre-SL, just click the “Save As” button, and proceed with the save. In Snow Leopard, single-file-type apps are no longer supported. The defacto Application type is a bundle.

I know I’m going to be repeating this a lot: as of Mac OS 10.6 the Script Editor application has been renamed AppleScript Editor and has been relocated from the /Applications/AppleScript/ to the /Applications/Utilities/ folder.

Also, Rosetta, which allows PowerPC-compiled applications and AppleScripts to run on Intel Macs, is an optional install. Most AppleScripts on this site are either Intel-compiled or Universal Binary, but some older scripts may not run without Rosetta (especially if you had downloaded older versions of them or those that I never got around to updating as Universal Binary). So when performing your installation of Snow Leopard it’s probably a good idea to include Rosetta.

I just noticed this today using iTunes 7.6, but I do not know how long this “situation” has existed.

As far as I’ve always known, when you delete a track from a playlist using AppleScript, the track is removed from the playlist; when you delete a track from library playlist 1 (the Main library), the track is removed entirely from iTunes. In both cases, the track’s file remained in its location in the Music folder. Today I noticed that when doing a delete from library playlist 1, the track was not only removed from iTunes but its file was moved to the Trash! I could not figure out a way to keep the file from doing so. I tried deleting it from its Master Library–in this case the “Music” playlist–but it still went to the Trash. Deleting from a simple playlist worked as expected: the track was removed from the playlist but remained in the Master Library.

Recently, some users of Make Bookmarkable wondered where their tracks went and it turns out they were moved to the Trash. Not so bad, since the bookmarkable copy was re-added (I believe). Still, this is not the behavior I expect when using delete. And until recently this wasn’t the behavior anyway.

If this is how delete works now, then there is no way to remove a track from iTunes via AppleScript and subsequently keep its file, which is an option when you manually delete a track using the Delete key.

Perceval McElhearn has posted How To Write Your First AppleScript at Macinstruct. It’s a nice intro for those of you who want to get started. BTW: Perceval is the descendant of my good friend and Mac aficionado Kirk McElhearn. The nut don’t fall far from the tree.