dougscripts.com

Tips and Info

January 10 2011 - 12:42 pm

Skip Back or Ahead Custom Mods

Recently, I was watching a DVR of a football game I had made with EyeTV. In general, I prefer to skip the parts that aren't showing football players playing football. So, while watching the game on iTunes I used the script Skip Back or Ahead to jump ahead 120 seconds when necessary.

The thing about that script is that I didn't exactly streamline the workflow. Here are the steps required to skip ahead 120 seconds:

  1. Click the iTunes Scripts menu, scroll, and click the script's name to launch the script
  2. Enter the number of seconds in the dialog that appears--in this case the three digits "1-2-0"
  3. Click the "Ahead" button to dismiss the dialog

...and then the playing iTunes track, my football game, advances two minutes. But although it looks like just three quick steps it seems to take about a half an hour to perform. OK, not a half an hour. But it does seem kinda clunky to have to do a lot of mousing and key pressing just to perform a simple task like skipping ahead.

Here's what you can do to streamline the script at your house.

(more…)

September 16 2010 - 10:51 am

Take Your Album List WIth You

You probably know that you can use iTunes' Print command to create CD box labels and stuff, which I'm guessing not many people need much any more. You can also print a list of all your Albums, sorted by Artist. Big whoop? Well, instead of printing it to paper, use the PDF Service in PDF Adder to add the listing as a PDF to iTunes' Books library. It syncs to the iBooks app on your iPhone or iPad, too, so you can keep a portable list of all your albums with you. Update it once a month or so. Mine came to thirty-two pages! (Gotta work on my iPhone Cross-Country-Ski-Fingers Speed Scroll technique.)

BTW: I was reminded of album list printing when I heard Kirk chatting with Chuck Joiner about his new book, Take Control of iTunes 10: The FAQ (which will also sync nicely to your iBooks app).

March 10 2010 - 10:42 am

Migrate Your iTunes From Windows to Mac

I frequently get asked if there is an easy way to move an iTunes library (files, playlists, ratings, and all) from a Windows machine to a Mac. My friend Kirk McElhearn has written it all down in this how-to at Macworld.

January 14 2010 - 9:29 am

Size of Files, Size of Library

It's not the size of your "iTunes Media" files that best describes how big your media file collection is. Often, querying Correspondents will report that their iTunes Media folder is so many GBs (or so many days-worth). But if that total includes a lot of video then the number of files is smaller than the same-sized folder containing just 128kbps audio files (eg: my "Star Trek" with Extras at 6GB+ is a little smaller than my "Compilations" folder which contains over a thousand files). Very few of my scripts and apps directly work on the files in the iTunes Media folder anyway, so in many cases its size is irrelevant; scripts work with tracks in iTunes, so the number of tracks is more important than the size of their files. A better relative measurement for comparison purposes is the size of your "iTunes Music Library.xml" file (located in ~/Music/iTunes). It has an entry for each track in your library and all (well, most) playlists. Therefore, the more tracks and playlists you have the larger the XML file will be.

September 30 2009 - 9:27 am

Gathering Far-Flung Files

I've gotten several emails lately inquiring about scripts and apps that can assist with gathering up far-flung files from old music folders. It's the sort of thing that happens when you move to a new computer, upgrade iTunes, and add hard drives without doing the requisite housekeeping at the time (or on a regular basis). This is fairly typical:

Throughout the last 4-5 years, Iʻve ended up with an enormous bunch of music which is all on one of my hard drives, and Iʻd like to consolidate all of it, get rid of the dupes, junk/damaged recordings, etc. For instance, some of the data are backups of my old iTunes libraries that I created before upgrading to newer versions. I like the way the script addToLib works. but Iʻm looking for a way that I can accomplish the same thing without moving the music from each album folder, and then Trashing each folder individually.

I've been recommending using Music Folder Files Not Added which allows you to scan a folder any number of folders deep for files not in the iTunes database and optionally add them. Of course, you may still want to Trash the folder once the files are added—and this presumes you have "Keep iTunes Media folder organized" set—but you'll only have to move the single parent folder to the Trash and not dozens of sub-folders. And if duplicates are a problem, there's always Dupin, right?. Yes, still some work involved (after all, it took a long time for you to make that mess!) but operating on one set of parent folders at a time will make the process easier.

September 29 2009 - 7:31 pm

iTunes Status Display Sees Your Selection

Rob Griffiths points out that in iTunes 9, as you are selecting or de-selecting tracks in any playlist or library, the size and time in the status display along the bottom of the iTunes browser window increases or decreases respectively. Neat!

September 23 2009 - 10:33 am

Rosetta Redux

As you may know: to run AppleScripts that were compiled on a PowerPC machine on Intel machines (and therefore Snow Leopard) requires Rosetta—an optional install on your SL install disc. While Rosetta is a fairly small install, some people have expressed an interest in staying Rosetta-free. There are quite a few of these types of AppleScripts here on the site and I'm working on updating them to Universal Binary (although a good percentage of these in the Retro Scripts category probably won't be updated by virtue of being obsolete). Long-time visitors may also have some of these scripts in their collections.

While you could wait for me to update these kinds of scripts to UB—disclosure: one of these days I will get around to admitting that I am a notorious procrastinator—you can update these scripts yourself by doing what I would do: open the script in AppleScript Editor, noting whether it is a compiled Script (.scpt) or an Application (.app), and re-save it. It will be re-compiled for your machine type, and if it is an Intel machine, will run without Rosetta. The "Run Only" and "Startup Screen" checkboxes can be left unchecked. Script Applications that use idle handlers need to be checked "Stay Open".

During the Save, if AppleScript Editor informs you that the "Document Format is Read Only: This script application is in a format that is no longer supported...", the case for non-bundled applications compiled pre-SL, just click the "Save As" button, and proceed with the save. In Snow Leopard, single-file-type apps are no longer supported. The defacto Application type is a bundle.

The AppleScript Release Note: 10.6 Changes page at Apple has more on this.

September 22 2009 - 10:33 pm

Copy iTunes Store Tracks in Browse Mode

You may have been (prematurely) lamenting the inability to drag tracks from the iTunes Store to a playlist on your machine for later purchase because of the new format. Well, just put the store in Browse mode (Command-B). Tracks will be available the old-fashioned way, more or less:

September 16 2009 - 8:51 am

Get Current Track from iTunes LP

When you're playing an iTunes LP the Command-L shortcut to reveal/select the track in iTunes doesn't work. Unless.

Place the iTunes LP "booklet" in its own playlist (select it and press Shift-Command-N) and open that playlist in its own window by double-clicking the name of the playlist (or choose "Open in New Window" by Control-clicking the playlist name). Double-click the booklet to open the iTunes LP in the playlist window just opened. Now you have access to the main iTunes browser while the iTunes LP stuff is playing in the separate window.

This script will emulate the Command-L shortcut providing the iTunes LP is in a separate window:

tell application "iTunes"
	if player state is stopped then return
	set pID to (get current track's persistent ID)
	set mLib to (some playlist whose special kind is Music)
	reveal (some track of mLib whose persistent ID is pID)
end tell


September 6 2009 - 8:21 pm

Target QuickTime Player by application id

If you've got a script that needs to target QuickTime Player in Snow Leopard you probably really want to target "QuickTime Player 7". Otherwise, if you target "QuickTime Player" the QuickTime Player X app will run and it doesn't have the AppleScript Goodness like QTP7. However, if the script also has to run in Leopard, you have to target "QuickTime Player"--without the "7". But you don't need to write two scripts.

In OS 10.5 and later you can target an app by its application id. I remember seeing that in the AppleScript Release Notes for 10.5 thinking "Hmm. Now how can I use that" and never really thought of anything. Until I needed to access QTP in both 10.5 and 10.6.

This tell block:

tell application id "com.apple.quicktimeplayer"
	-- do something in QuickTime Player
end tell


...will target "QuickTime Player" in OS 10.5 and "QuickTime Player 7" in OS 10.6. The application id is the same for each, so it makes no difference what their names are. And the AppleScript architecture is virtually the same in both operating systems. (Remember that "QuickTime Player 7" is an optional install either during installation or from the "Optional Installs" folder on your installation disc.)

"QuickTime Player X" is a drastically different version of the player app and scripts written for QTP7 will not play well with it. However, it is scriptable to a modest extent. Its application id is "com.apple.QuickTimePlayerX" in case you need to target QTPX specifically.

Site contents © 2001 - 2019 (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 interrupt the one doing it.