Comments on: iTunes Scripting Seizure Official blog of Red Sweater Software Fri, 09 Oct 2015 20:11:22 +0000 hourly 1 By: jakattak Fri, 22 Dec 2006 08:46:29 +0000 It’s taken days to locate something I didn’t even know the name of until I linked here. I’m a recording artist still mostly crawling around in the analog world. I cannot seem to attach a proper “TAG” to my original songs so they will be recognized and ‘picked up’ by Gracenote online. Now I understand it has something to do with ‘scripting’ and ‘encoding’ TAGS on my song wave files. If anyone has any other info or links concerninf this dilemma go ahead and drop me an email: I could not find anything addressing this issue at studio central.
bye for now……………jak

By: Pierre Igot Thu, 07 Dec 2006 22:17:06 +0000 I suspect the fact that the Preferences dialog is modal is because it’s always been so :). iTunes is an “old” application (even iTunes 1.0 was a revamp of an already existing application) and Apple simply have never bothered to “update” that aspect of the application.

I suspect it is the same reason why the track information dialog box too is a modal dialog. I find this even more irritating than the modal Preferences dialog. I certainly invoke the track information dialog box far more often than the Preferences dialog (although I am constantly forced to travel to Prefs for changes in encoding settings, which is really not appropriate either). There are some many tracks out there with improper tags, and even the stuff from the CDDB needs to be corrected all the time… Each time you have to go through that modal dialog. Painful!

The problem with the modal track information dialog is that Apple has kept adding stuff to it over the years, so there really is a lot of information in there right now. They are also using these “Next” and “Previous” buttons within the dialog box that actually enable you to change tracks without exiting the modal dialog, but it’s a clumsy workaround for a very real shortcoming.

I really feel that iTunes should have a track information drawer or inspector. But that would require a major UI revamp, and somehow I don’t think Apple is going to do this any time soon.

By: Rich Pollock Thu, 07 Dec 2006 14:54:23 +0000 iTunes scripting is highly frustrating. I think Brennan seems to have covered everything rather comprehensively, but it’s the lack of a “playlist” object that grates most for me, especially in terms of script “understandability”.

And this article really does highlight the stupid decision of having a modal preferences dialog in the first place. Why? Just why?

By: Daniel Jalkut Tue, 05 Dec 2006 22:19:19 +0000 Brennan: I agree that iTunes’s scripting support is frustratingly inadequate. The “updatePodcast” and “updateAllPodcasts” items are particularly bad.

Cameron: Good idea, but one major caveat with synthesizing keystrokes like that is that you fall victim to combining with whatever keys the user may already be pressing. For instance, it’s quite common with FastScripts (and other script runners) to attach a script to a keyboard shortcut. What happens when I attach a shortcut to the script with the Cmd key? I end up getting Front Row (cmd-esc). When I attach a shortcut including Cmd-Opt, the script brings up the force-quit dialog.

By: Cameron Hayne Tue, 05 Dec 2006 20:29:08 +0000 In my experiments, the following AppleScript serves to close the iTunes preferences if it is open. If only the main iTunes window is open, it does nothing – but there might be other effects that I haven’t noticed.

tell application “System Events”
set frontmost of application process “iTunes” to true
key code 53
end tell

By: Brennan Young Tue, 05 Dec 2006 19:41:33 +0000 I dunno why everyone seems so enamoured of the iTunes scripting implementation in the first place. It implements a good half-dozen cardinal ‘sins’ (at least according to Apple technote 2106).

Which states very clearly, “If a term consists of more than one word, separate the words with spaces. Do not join the words together with capital letters or underscores.”

It also says “If a property or parameter refers to an object, its type should be an actual object, never data that signifies an object.” It then goes onto give the example of a ‘bad’ command, ‘closeWindow’ and suggests instead using the ‘close’ command on a properly modelled ‘window’ object. So far so good.

Then I look in the iTunes dictionary and I see ‘updatePodcast’ and ‘updateAllPodcasts’. WTF? What about having a ‘podcast’ object, and an ‘update’ command instead?

Hardly any of the iTunes preferences are available to the dictionary. It would be very useful to set those, for example to specify what format the ‘convert’ command is going to create. (Better still, ‘convert’ should have optional parameters for compression/encoding settings).

And why can’t you use the filter reference form? e.g. tracks whose name contains “blah” fails.

And why are ‘smart playlists’ not modelled properly?

And what about this occult use of the word ‘view’ – which is usually what we might call a playlist. Not a very informative name for something which you’ll be scripting often. ‘view of browser window 1′ might be usefully referred to as ‘frontmost playlist’ and save a lot of hair pulling.

And why can’t I find out whether iTunes is busy burning a disc so I can (for example) wait before quitting it. I have a script which quits iTunes if it is running in a background account, when launched from the foreground account. It would be nice to know that I could avoid screwing up a disc burning operation under those circumstances.

Really, disc-burning needs to have an object model, properties like burn state, percent complete, a reference to the playlist getting burned, which drive is getting used – I have two burners in my Mac – and so on. The same goes for encoding/compression. We need to know what state iTunes is in. This is related to the whole ‘modal prefs window’ issue, I think. It’s just sloppy.

The iTunes scripting implementation needs a lot of work, and we neeed to demand that it happens. Apple is paying lip-service to AppleScript in too many areas.

Well at least iTunes has a scripting implementation, which is more than can be said for Apple’s ‘professional’ ($$$) apps.