dougscripts.com

AppleScript

September 10 2009 - 7:49 pm

Dead Tracks a Problem for Genius?

There are one or two discussions going on at the Apple Discussions boards about users being unable to properly update Genius in iTunes 9, which apparently prevents Genius Mixes from kicking in. Or something. Some posters have gotten fruitful results after eliminating any dead tracks with Super Remove Dead Tracks.

Download and install the script. Turn Genius off. Run the script. Turn Genius back on.

September 10 2009 - 12:12 pm

Smart Playlists Are Not 'Scriptable

Getting an avalanche of email informing me that Smart Playlists in iTunes 9 can use boolean-like operators when defining criteria. While that's great and all, Smart Playlists cannot be constructed with AppleScript so it has zero impact on scripting.

September 10 2009 - 9:27 am

UPDATED: Save Album Art to Album Folder v2.0

Save Album Art to Album Folder v2.0 is a collection of two scripts that will assist with exporting Album artwork to a track's parent folder, presumably the track's "Album" folder.

  • "Save Album Art to Album Folder" will export the artwork of the selected tracks or tracks in the selected playlist as a graphics file to the folder which contains each selected track's file--or a specific user-selected folder.
  • "Save Track Art to Album Folder" exports the artwork of the single selected track to its parent folder, replacing any previous version.

Read Me explains much more, including modifications you can easily make.

Universal binary for OS 10.5 and better only.

This latest version updates syntax for compatibility with Snow Leopard, streamlines some code, provides new bundled progress indicator app.

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.

September 2 2009 - 10:55 am

UPDATED: Lyrics via LyricWiki v2.1

Lyrics Via LyricWiki v2.1 addresses some changes in LyricWiki page formatting.

August 28 2009 - 2:56 pm

Updated a Handful

Nothing to do with Snow Leopard--what a relief, eh? I've updated seven scripts today:

These seem to be the most popular scripts that are affected by the "none/all" issue introduced in iTunes 8.2. There may be a few others, but I haven't gotten email feedback on those nor have I run across a problem with any other scripts I use regularly. But if you ever get a error like this:

...then let me know.

August 27 2009 - 10:36 am

Snow Leopard's QuickTime Player Duality

Speaking of Optional Installs, to get the AppleScript goodness of QuickTime Player you may have been used to, QuickTime Player 7 will need to be installed from Snow Leopard's Optional Installs. QuickTime Player 10.0 is the default install in /Applications/, but its AppleScript innards are radically different (some would say severely lacking) from previous versions. So for legacy purposes, you'll need QTP7. If you currently have QuickTime Pro, QTP7 is installed automatically in /Applications/Utilities/. Otherwise, it's an optional install.

August 27 2009 - 7:19 am

(Apple)Script Editor in Snow Leopard

I know I'm going to be repeating this a lot: as of Mac OS 10.6 the Script Editor application has been renamed AppleScript Editor and has been relocated from the /Applications/AppleScript/ to the /Applications/Utilities/ folder.

Also, Rosetta, which allows PowerPC-compiled applications and AppleScripts to run on Intel Macs, is an optional install. Most AppleScripts on this site are either Intel-compiled or Universal Binary, but some older scripts may not run without Rosetta (especially if you had downloaded older versions of them or those that I never got around to updating as Universal Binary). So when performing your installation of Snow Leopard it's probably a good idea to include Rosetta.

August 11 2009 - 10:44 am

Re-Posting Stream Startup Script

A couple few days ago I posted a script here that would ping the Radio Paradise stream until its server accepted the connection, suppressing the error dialog that would appear when a connection was denied. Well, that was the wrong version of the script. Here is the correct version, and the one I fire up every morning. You must select a radio stream track first, then run the script:

tell application "iTunes"
	if selection is {} then return
	set strm to (item 1 of selection)
	if (get class of strm) is not URL track then return
	repeat
		try
			play strm
			exit repeat
		on error m number n
			delay 15
		end try
	end repeat
end tell


The earlier script used the open location command, errors from which could not be defeated with the try block.

August 10 2009 - 9:55 am

UPDATED: Music Folder Files Not Added, v1.1

Music Folder Files Not Added is an application that will list the file paths of the files in your designated "iTunes Music" folder which are not in iTunes' library. Additionally, you can select a different parent folder and its contents will be compared to the iTunes library. Includes options to Add a selection of found files to iTunes or move them to the Trash.

This latest version fixes a problem with file paths containing single-quote characters.

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.