Archive for the ‘Controlling iTunes’ Category

April 1 '15 - 5:33 am
UPDATED: A Space Between v1.2

The few-seconds gap between tracks on recorded media is an artificial time. Devised to be just long enough to visually and sonically demarcate the tracks on a space-limited side of LP vinyl, the gap carried over to tapes, CDs and digital. It is unlikely that musicians playing a gig would pause such a short period of time before launching unto their next number…for every single number. Even so, we’re accustomed to the two-second rule when listening to recorded media. (And cross-fades? Utterly unnatural.)

A Space Between will play the tracks in the selected playlist and wait a user-entered number of seconds between tracks.

I’ve found that six to eight seconds of silence between tracks can be quite refreshing, especially between longer contiguous album tracks. But it adds something to the atmosphere of a mixed-track playlist, too.

How un-streamy.

This latest version of A Space Between is a maintenance update with a few minor performance tweaks.

Free stuff, dev ID-signed, more information and download is here.

March 29 '15 - 11:21 am
Play Selected Track and Cue Next

A Correspondent inquired about a script that would play a selected track in iTunes through to the end and then stop and then select the next track but not play it. In such a way, a playlist containing sequential musical cues required for a theatrical performance could be fired one track at a time, via the script, without a lot of stopping and mouse-clicking and swearing backstage (“Up yer scrim!”, “Purple behind!”).

This is such a script:

— Play Selected Track and Cue Next

tell application “iTunes”

— get the single selected track and play it

set theSelection to selection

if length of theSelection is 1 then

set theTrack to item 1 of theSelection


play theTrack with once

on error

## beep


end try

— the selected track is playing, now do some other stuff…

— get the playlist

set thePlaylist to (get view of front window)

— stash current fixed indexing value

set curfi to fixed indexing

— we want free indexing not fixed indexing

set fixed indexing to false

— compute next track’s index

set idx to (get index of theTrack)

if (idx = (count of tracks of thePlaylist)) then

set idx to 1


set idx to (idx + 1)

end if

— select the next track in the playlist

reveal track idx of thePlaylist

— restore fixed indexing to whatever it was before

set fixed indexing to curfi

end if

end tell

What you’d want to do is save this with Script Editor, named whatever you like, with a File Format of “Script” and put it in your [Home]/Library/iTunes/Scripts/ folder so it appears in iTunes’ Script menu.

Prepare a playlist and select its first track. When it’s time to actually play the track, don’t use any iTunes play controls; instead, fire the script. The script will play the selected track, figure out which track is next in sequence, select it, and then quit. iTunes will stop when the current track has finished by virtue of that with once parameter on the play command. When it’s time to play the next track, which is now the selected track, fire the script to play it and select the next track. And so on.

While assigning this script a keyboard shortcut will be convenient if you can keep a hand near the keyboard, something that could fire this via a physical remote control would be super boss. Under such circumstances, you may prefer—or it may be necessary—to save the script with a File Format of “Application”.

March 28 '15 - 10:54 am
UPDATED: I Hate That iTunes Done Chime! v3.0

Ripping CDs and converting audio files with iTunes isn’t something a lot of people do anymore. Ahh, to be free of the slow, ear-stabbing torture of the done-chime that sounds after every import or conversion.


Sure, you could lower the volume on your machine everytime that boodely-oop! drives another tri-tone nail into your brain. Or you could replace the done-chime with some other sound or silence! with I Hate That iTunes Done Chime!

This applet will allow you to replace iTunes’ Tri-Tone done chime (“The Hellmouth’s Doorbell”) with a System sound, a user-chosen AIFF file, or no sound (actually, a sound file provided that is just one second of silence).

This script hadn’t been updated since 2009, during which time the additional security and permission considerations of the OS prevented it from working. The script now asks for permisson before it moves any files around.

Dev ID signed and free to use, more information and download is here.

March 12 '15 - 12:08 pm
UPDATED: Quick Convert v4.1

Quick Convert v4.1 will convert all or just the selected tracks of the selected Playlist using your choice of available iTunes encoders, restoring your Preferences-set encoder afterwards. Works with importing selected CD tracks, too.

Additionally, you can:

  • Choose to delete and/or Trash the original tracks and/or files
  • Copy all converted/imported tracks to a new playlist
  • Optionally save AAC encoded tracks as M4B “bookmarkable” and re-add the converted files to the Audiobooks (Books) library

This latest version restores the Edit menu, which I removed during some kind of fit of minimalism. Unfortunately, you kind of need that guy if you want cut, copy and paste shortcuts to work in the app. There are also some minor maintenance fixes.

Quick Convert is free, but payment in appreciation requested. More info and download is here.

October 6 '14 - 8:01 am
UPDATED: Needle Drop v5.0

Needle Drop v5.0 will play each track in the selected iTunes playlist for a set time interval optionally starting at a set number of seconds into each track, beginning with the selected track. Handy for ‘scoping playlists.

The latest version adds support for OS X 10.10 Yosemite and iTunes 12 and has other minor tweaks.

More information and download is here.

August 16 '13 - 9:34 am
Toggle Stereo/Mono Audio Output

Correspondent Simon Crosbie has set up an amp and pair of speakers in his workshop which is connected to an Airport Express. Unfortunately, the speakers are some distance apart, so that he may be near one speaker or another at any time, and will only hear that channel’s output. Simon wanted to know if there’s a way to toggle between stereo and mono output so he can hear more than just half of a stereo recording.

Yes, there is a way. Go to System Preferences > Accessibility. Choose “Audio” in the left-hand list and in the panel that appears click the checkbox next to “Play stereo audio as mono”.

Goodnight everybody!

Wait a minute. I almost forgot I wrote this script to do it:

tell application “System Preferences”

reveal anchor “Hearing” of pane id “”

end tell

tell application “System Events”

tell application process “System Preferences”

set frontmost to true

tell window “Accessibility”

##–> pre 10.9 set monoStereoCheckbox to checkbox 2 of group 1

set monoStereoCheckbox to checkbox “Play stereo audio as mono”

if (get value of monoStereoCheckbox) as boolean is true then

set ddMessage to “Switch to STEREO output?”


set ddMessage to “Switch to MONO output?”

end if

if button returned of (display dialog ddMessage buttons {“No”, “Yes”} default button 2) is “Yes” then

tell monoStereoCheckbox to click

end if

end tell

end tell

end tell

if application “System Preferences” is running then

tell application “System Preferences” to quit

end if

[UPDATE November 13, 2013: The original script has been updated for Mavericks. Note the commented line for pre-10.9 systems and the line that follows it. Set the monoStereoCheckbox variable using one or the other depending on the OS.]

[UPDATE October 17, 2014: Another change for compatibility with Yosemite. The line “set frontmost to true” is inserted right after the first tell application process “System Preferences” line near the beginning.]

I would save this script in the system wide Scripts menu (install it in ~/Library/Scripts/). Because the script uses (gulp) GUI scripting you must make sure that “Enable access for assitive devices” is checked in the Accessibility System Preferences panel.

Smarties among you can figure out how to switch mono/stereo when using AppleScript to change AirPlay speakers.

And bear in mind that while the script works with the current OS (and probably an OS that may be released this Fall), Apple may change the layout of the System Preferences panels in a future update, in which case the GUI scripting will have to be updated.

November 30 '12 - 9:54 am
UPDATED: Play Random Album v3.1

Play Random Album scans your library, creates a playlist of a complete single album choosen at random and begins playback of the playlist created. Works great when assigned a keyboard shortcut.

This version works around a problem with iTunes 11 whereby after starting to play the first track of the new playlist no additional tracks appear in the MiniPlayer/Up Next and only the first track ever plays. The script now waits until the playlist is completely assembled before starting to play it.

June 6 '12 - 10:52 am
UPDATED: Change Hidden iTunes Preferences v3.0

Thanks to a couple of recent posts at Mac OS X Hints and Cult of Mac, Change Hidden iTunes Preferences saw a lot of downloads in the past week or two. Unfortunately, I hadn’t had time until today to give it an update. An older preference, “Show buttons horizontally”, is no longer applicable and a new preference, “Disable ‘elastic’ scrolling behavior”, applicable in Lion, needed to be added. These changes are in the latest version of Change Hidden iTunes Preferences.

Additionally, this version is written as a Cocoa-AppleScript applet and can only be run on OS X 10.6 or better.

February 27 '12 - 10:26 am
Custom Playlist Column Views, Sorta

Here’s something I’m often asked which Correspondent Rob Falk put succinctly: “Is there a way to clone a playlist view…other than the Library [using Assimilate View Options]? I frequently need to create a playlist that has a specific set of columns, that are not the same as the library, and was looking for a way to automate that.”

There sorta kinda is.

My first thought was to use AppleScript to just duplicate an existing playlist that already had the requisite view settings. (The duplicate command is typically used to copy a track from one playlist to another.) Unfortunately, when iTunes’ AppleScript duplicate command is used to copy a playlist it—bafflingly—creates a new untitled and empty playlist using the properties and views of the Music library playlist. Same as just creating a new playlist. That doesn’t seem right, does it? You’d think—well, I thought anyway—that using duplicate to copy a playlist would behave the same as the playlist contextual menu command “Duplicate” (control-click or right-click on the name of the playlist):

So, my next thought was…just use “Duplicate”. The playlist will be perfectly duplicated, column views and all, and selected in the Source list. Now you’ll have a new playlist named the same as the original with a “1” at the end and which is populated with the original’s tracks (if it had any). You could create a bunch of playlists with columns set the various ways you like and then “Duplicate” them when you required one. Just rename the new duplicated playlist and delete any tracks. And that part can be automated.

The workflow, then, is to “Duplicate” a playlist manually with the contextual menu command and then run this script right afterwards:


January 20 '12 - 10:40 am
UPDATED: Play Random Album v3.0

A Particular Correspondent noticed that the previous version of Play Random Album was biased towards larger albums when selecting one at random. The problem was that it grabbed a random track first and built the album out using the album of that track. Well, of course. Albums with more tracks had a better chance of being selected by virtue of having more tracks in the pool, as it were.

The latest version of Play Random Album actually chooses a random album name first which gives every album a fair chance. I’ve also speeded it up a little and tweaked some error checking. Attach it to a keyboard shortcut and it almost feels native.

I just bought a set of Bose 201 speakers and I’ve been burning ’em in (ahem, letting them experience a variety of frequencies) by playing random albums using this script. Works great.

Site contents © 2001 - 2015 (that's right: 2001) Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc with whom this site has no affiliation.