dougscripts.com

December 16 2012 - 2:10 pm

Show Current Song, Really

iTunes 11.0.1 fixes an issue with the "Show Current Song" (the Command-L shortcut). Before iTunes 11, using this command would select the currently playing track in the playlist it was playing from. In iTunes 11 there seemed to be some inconsistency with this behavior in different playing contexts. But now with iTunes 11.0.1 the command consistently selects the currently playing track in that track's library regardless of its playlist source (if any). Coincidentally, this also happens to be the task performed by a script I wrote about to workaround the afore mentioned inconsistency.

I frequently find it convenient to access the playlist a track is playing from but "Show Current Song" doesn't do this any more. So here is a script that selects the currently playing track in its source playlist (the pre-iTunes 11 behavior). I'm guessing the reveal command was fixed because this didn't work quite right with iTunes 11, or maybe it had to do with those inconsistencies.

tell application "iTunes"

try

reveal current track

end try

end tell

Interestingly, the playlists list will become visible if it is not already and the correct track selected. The try block prevents an error in case the script is run while iTunes is not playing, in which case there is no current track property. Attach a shortcut. Option-Command-L might be a good one. (Shift-Command-L is used by the "Search With Google" Service.)

December 14 2012 - 7:09 pm

Dupin v2.5.4 Released

I've posted an update to Dupin. The latest is version 2.5.4 (however, for a brief time, v2.5.3 was available).

The latest update is a maintenance release with some minor fixes: clarifies cloud track detection information, better detection of misconfigured iApps.plist file, fixes issue in v2.5.3 whereby the Purge dialogs do not appear correctly on some systems.

December 13 2012 - 11:00 pm

Looks Like reveal Works Correctly

iTunes 11.0.1 appears to fix the issue with the AppleScript reveal command, mentioned here. But Command-L (Go to Current Song) apparently does not yet work correctly. Update: Go to Current Song/Command-L does work correctly. But it doesn't select the track in the playlist it may be playing from; it selects it in the Music library. This AppleScript will select the currently playing track in the playlist from which it is being played:

tell application "iTunes"

try

reveal current track

end try

end tell

December 13 2012 - 10:52 pm

iTunes 11.0.1 Released

Apple has released iTunes 11.0.1, an update that makes some fixes to AirPlay, iTunes Match, and provides the obligatory "stability and performance improvements".

December 3 2012 - 9:42 am

Go to Current Song and reveal Busted in iTunes 11

The menu command "Go to Current Song" (in the Controls menu of iTunes 11) indeed shows the playlist that the current song is playing from, but it does not select the current playing track. The Command-L keyboard shortcut no longer works either. Looking for an AppleScript workaround, I found that reveal current track behaves the same way. The reveal command still selects a playlist, eg: reveal current playlist.

Update: Apparently these fails happen when a song is playing from a playlist but it's OK when a track is playing in the Music library.

Update 2: Here's a script that will reveal the current song in the Music playlist no matter where it is playing. Be sure to give it a shortcut.

tell application "iTunes"

activate

try

set dbid to (get database ID of current track)

set musicLib to some playlist whose special kind is Music

set theTrack to some track of musicLib whose database ID is dbid

reveal theTrack

end try

end tell

Obviously, this doesn't help get you back to the current playlist. But if you need to access the playing track for some other reason then it'll do. You can always right-click the LCD and access the current track's Get Info, Show in Playlist, and so on.

Update 3: Kirk has an important observation on this issue.

Update 4 (December 16): This appears to be fixed in iTunes 11.0.1.

December 2 2012 - 8:59 pm

Show Track Count and Time of Selected Playlist

There's seems to be a bit of inconsistency with the way iTunes 11 displays playlist time information as DD:HH:MM:SS. Sometimes times are displayed in the Status Bar at the bottom and sometimes a decimal version will be displayed beneath the playlist's name at the top of the browser. I can't quite get a grasp on something like "7.6 days" though.

Here's a script you can attach a shortcut to that will simply display a dialog box listing the name of the selected playlist, the number of tracks it contains, and the time of the playlist as DD:HH:MM:SS:

tell application "iTunes"

set thePlaylist to (get view of front browser window)

display dialog (get name of thePlaylist) & return & return & ¬

(get index of last track) & " tracks" & return & return & ¬

(get time of thePlaylist) buttons {"OK"} default button 1 giving up after 300

end tell

December 1 2012 - 11:36 am

UPDATED: Assimilate View Options v3.1

Assimilate View Options v3.1 re-creates a single selected playlist so its View Options (visible columns) are the same as the Music library (taking advantage of the fact that new playlists acquire the Music library's View Options).

This latest version worksaround iTunes 11's shuffle/song repeat difficulties which tripped an error when trying to re-apply those settings and prevented the script from completing properly.

November 30 2012 - 10:49 am

Interesting play Issue with MiniPlayer

As I mentioned below, I had to fix a script to workaround a problem playing a playlist when only one track had as yet been copied to it, which prevented the rest of the subsequently added tracks from being recognized by MiniPlayer and Up Next; thus, only the first track would play. Similarly, if you were to play (the AppleScript command) any track in a playlist, the following tracks will not play because they haven't been recognized by MiniPlayer and Up Next ("No upcoming songs").

Doesn't go good when Mini Player is empty:

tell application "iTunes"

set aTrack to item 1 of selection

play aTrack

end tell

You can play the playlist and everything's OK. You just can't initiate play of the entire playlist by playing one of its tracks with AppleScript.

Goes good and loads in MiniPlayer:

tell application "iTunes"

set aPlaylist to view of front window

play aPlaylist

end tell

Additionally, I found that if the MiniPlayer was already loaded up with tracks, playing a track (via AppleScript) from anywhere would play that track and then resume with whatever is next in MiniPlayer.

November 30 2012 - 10:26 am

iTunes 11 Loses playlist window

Technically, you can't open a playlist in its own window in iTunes 11, so the playlist window element is moot.

November 30 2012 - 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.

Site contents © 2001 - 2025 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.