AppleScript
iTunes AppleScript Delete Bug Moreso
A lister on the AppleScript mailing list writes:
The Scripting Interface Guidelines agree with you: make and delete should be used to create/destroy objects completely, while add and remove should be used to add/remove existing objects to sub-groups. e.g. Compare Address Book, which uses add and remove to add/remove existing person objects to group objects. iTunes predates the SIG, however, and while its scripting interface is fairly extensive it does suffer a number of longstanding design quirks.
Yep. I'd be happy if they just made it like it used to be.
iTunes 7.6 AppleScript Delete Bug
The more I think about the delete issue, mentioned below, the more I think this is a bug and not a feature. I have filed a bug report in any case. Although, I do like that you can trash a file from within iTunes, I do not like that you cannot preserve a track's file. A dandy way for delete to work would be as follows:
1) delete a track from a playlist to just remove it from the playlist.
2) delete a track from its Master Playlist to remove it from iTunes entirely but preserve the file (I tried this hoping it would work, but it does not).
2) delete a track from library playlist 1 to remove it from iTunes entirely AND trash its file.
(I don't know why there isn't a remove command in iTunes, which would make more syntactic sense. The Finder's AppleScript delete command will send a file to the Trash.)
Needless to say, this bug affects several scripts which use delete to remove a track from iTunes without actually trashing the file. For instance, Make Bookmarkable will delete a track from iTunes and then re-add it. Under iTunes 7.6, the track's file is moved to the Trash; when it is re-added, unless the user has "Copy files to iTunes Music folder when adding to library" checked in Preferences, iTunes will presume the track's location is the Trash. Empty the Trash and bye-bye file. This is exactly what is happening to some users.
I can only hope that Apple will see this as a serious bug--it being part of the AppleScript component of iTunes, I am sorry to say that I think it is doubtful--and fix it soon.
Delete Bug or Feature?
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.
So, what's up with that?
UPDATE: Make Bookmarkable v2.2
The iTunes 7.6 update has some troubles, AppleScript-wise. I'm not exactly sure where the problem is, however, the first evidence of it occurs with Make Bookmarkable. An "Apple Event timeout" error occurs when multiple tracks are selected. I have posted a workaround and I am investigating the problem so I can file a bug report with Apple.
iTunes 7.6 and QuickTime 7.4 Released
Apple has released updates to iTunes and QuickTime. I'll be on the lookout for AppleScript features and post info when necessary.
Am I Being Ripped Off?
I invite regular visitors of this site to have a look at the descriptions for this app and see if they are not virtually identical to many of the scripts I offer here. I gave the developer of this app permission to use one single snippet of code in one script of mine. Do you think that they over-extended my generosity?
NEW: Rip AAC Old School v0.9
Now that iTunes doesn't rip or convert AACs using constant bit rates (see this MacFixIt article), users of Join Together can't take advantage of the Pass-through option, which encodes the final joined file much faster. Rip AAC Old School is an AppleScript wrapper for the command line tool afconvert. It will rip CD tracks as AAC using Constant Bit Rate (CBR) so that ripped tracks will all have the same bit rate. I tested it pretty thoroughly here, but I'm still keeping my fingers crossed.
UPDATED: Tracks Without Artwork to Playlist v2.3
I've updated Tracks Without Artwork to Playlist to work with Leopard. Unfortunately, this particular download is just a plain .zip file--no fancy installer .dmg, at least for now. I've got to rebuild my little workflow that creates those so it can play well in Leopard.
Leopard, Scripts and Migration Assistant
A Correspondent writes:
"I have managed to eliminate a '-10960' error when using my favourite scripts by simply removing the Scripting Additions folder from /Library/ folder. Which of the 8 items I had in this folder was responsible for the errors I can't say. What I do know is that the Migration Assistant application is responsible for copying these files into my clean install of Leopard. Anyway, problem solved. You may want to let your other users know of this solution should you see fit."
Scripting Database Events
Macscripter has a great overview on scripting the Database Events application, which front-ends sqlite 3. I haven't played with Database Events a lot, but the Macscripter article has more interesting info than I've seen elsewhere (if you've got the second edition Neuburg you might have been swayed away by his disdain for Database Events). Database Events can be handy for temporarily storing track data and doing it quickly so I aim to do some more work with it.