dougscripts.com

January 9 2011 - 12:13 pm

UPDATED: Just Play This One v3.0

I mentioned how easy it is to play a single selected track via AppleScript before. I've finally updated the perennial Just Play This One to use the easier syntax. It works great when you assign it a keyboard shortcut.

January 6 2011 - 1:45 pm

UPDATED: Rip A Few My Way v4.0

Import CD tracks with any encoder on-the-fly using Rip A Few My Way v4.0. After the rip, your preferences-set encoder (Import Settings) will be restored. Optionally copy the newly-ripped tracks to their own playlist.

This latest version correctly runs under iTunes v10 and better and includes maintenance fixes and finesses.

January 4 2011 - 1:49 pm

Server Issues

My apologies to visitors who were seeing errors earlier today. My hosting company was having some issues. The site should be OK now.

December 28 2010 - 1:19 pm

Get a Track Reference from a File Path

Correspondent Wayne B. recently wondered if there is a way to get a reference to a track in iTunes based on its file path. Well, unfortunately, you can't do something like this:

tell application "iTunes"
	set trackRef  to (get some file track of library playlist 1 whose location is "some/file/path.ext")
end tell

That will generate an error. But you can trick iTunes into giving you the track reference by using the add command--if you are certain the file is already in iTunes' database. When you add the file iTunes will check its database for the the corresponding library track for you and if it exists will give up the reference--and it won't re-add it:

set theFile to choose file
-- or however you get the file path

tell application "iTunes"
	try
		set trackRef to (add theFile as alias)
		tell trackRef
			log (get name)
			# and so on...
		end tell
	end try
end tell


But remember that if the file isn't already in iTunes' database then iTunes will add the file as a matter of course, which may not be what you want. So this trick may work best only when you know a file is currently in your library.

You will not want to use the open command instead of add, because open will compel iTunes to play the file in addition to any add-housekeeping.

December 15 2010 - 6:23 pm

iTunes 10.1.1 Available

Looks like some minor fixes are available in iTunes 10.1.1.

December 15 2010 - 3:22 pm

iBooks v1.2 Available

Apple has posted iBooks v1.2 for iOS devices with some cool new features including PDF and notes printing and Collections creation for books and PDFs.

November 30 2010 - 9:48 am

Create Default Smart Playlist Templates

A problem with Holiday music hanging around your iTunes library all year long is that, without a cautious Smart Playlist strategy, Grandma Got Runover by Mannheim the Christmas Donkey Steamroller can disrupt your tranquility at any time of year. Like pool-side in August. And there is nothing un-cooler than that.

Now it's unlikely that I would create a regular playlist containing any speck of Holiday music during non-Holiday times of year on purpose. But you gotta watch them Smart Playlists. Thus, for a while, the criteria for every new Smart Playlist I created started with "Genre does not contain Holiday|Xmas|Christmas".

That's a pain to have to remember. And to enter for every new Smart Playlist.

However. The script Export Smart Playlist Criteria allowed me to export a Smart Playlist template that has several of my preferred Smart Playlist criteria already entered. These would include "Genre does not contain Holiday|Xmas|Christmas", "Live Update", and several other idiosyncratic restrictions and requirements. Now whenever I want to quickly create a new Smart Playlist I import that template XML "starter" and then choose "Edit Smart Playlist" from its contextual menu to add only minor finessing.

Now, whether you care to read on depends on whether you are thinking either:

"Dude, you can just keep a generic Smart Playlist in your sidebar and Duplicate it like whenever."

(in which case you're right, you win, like whatever) or:

"But Doug. You could write a script that automatically loads and selects your generic Smart Playlist template file by pressing a shortcut key!" (more…)

November 29 2010 - 10:49 am

Library Benefits

A Correspondent observes that PDFs and digital booklets are no longer lodged in the "Music" library but in the "Books" library. Thus he laments that he is unable to access these books alongside the music tracks while browsing the "Music" library. While book-type tracks and music tracks can reside in the same playlist, yes, they do belong to different libraries. But creating a separate playlist for every album with a PDF or digital booklet doesn't seem very efficient.

I used Change Hidden iTunes Preferences to toggle the visibility of the "Library" library playlist. In the pic below it is listed atop the other library playlists. In the old days, this was the main library playlist and listed everything in the library. Well, it still does. When the "Library" is available, you can use the Column Browser to access an entire Album, which will include any associated booklet (providing the Artist/Album tags correspond correctly):

(The yellow highlight over the booklet is an artistic representation.)

November 18 2010 - 12:55 pm

Where'd My Half-Star Ratings Go?

I've been hearing from Correspondents that the half-stars they had meticulously set in their track ratings have disappeared. I think one of the v10 updates wiped out the half-star preference or something. Anyway, you can bring back the half-stars by doing the Terminal thing (quit iTunes first):

defaults write com.apple.iTunes allow-half-stars -bool YES

Or you can use Change Hidden iTunes Preferences which has an option to toggle 'em.

November 18 2010 - 11:30 am

Just Play This Track and Stop Redux

For years many iTunes users and Correspondents have asked about a script that can just play the selected track and stop. Various methods using timers and delays and idle handlers were thrown at the challenge but nothing worked perfectly. But then: the iTunes Team quietly added a once parameter to the iTunes play command.

tell app "iTunes" to play item 1 of selection with once

Run that on a selected track and iTunes will play it once and then stop.

You know when they added it?

In iTunes 6!

Incredulous, I went back to my original write-up on iTunes 6 from October 2005. Whack! It was the only AppleScript change I even mentioned...and then promptly forgot about. I even managed at the time to write a Missing Menu Script using it.

In any case, all of this was precipitated by a posting at Mac OS X Hints awhile back, authored by fellow AppleScripter Laine Lee, which mentions the once parameter and just-play-once-and-stop trick.

I can't believe it took five years for me to rediscover it.

Site contents © 2001 - 2024 (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.