dougscripts.com

AppleScript

July 27 2007 - 6:56 am

Capacity and Free Space Bug?

I haven't thoroughly investigated this, but I thought I'd put it out there. Using AppleScript you should be able to get the capacity and free space of a mounted iPod. These are two properties of source, along with kind. Thus, the result of this snippet should be a list of numbers representing the free space of each mounted iPod:

tell application "iTunes"
	get free space of every source whose kind is iPod
end tell

I get 0.0 each time. This is wrong, as my Video iPod has well over 12GB of free space. Likewise, I get 0.0 if I attempt to get thecapacity.

This occurs with iTunes 7.3.1 with the iPod I mentioned above. Because the rest of my family is currently away with their iPods, I was only able to test a second generation Mini with iTunes 7.1.1 and the snippet works; it does not work with iTunes 7.3.1. So I can only assume that it's not the iPod but iTunes. Regrettably, I do not know which version of iTunes this bug first appeared.

This affects a small number of AppleScripts, notably "Rip To iPod" which uses capacity and free space to determine if there is enough room on the iPod to copy ripped CD tracks. Because of this bug, it always reports that there is not enough room. I'll update "Rip To iPod" to work around this.

July 17 2007 - 1:20 pm

Get Lyrical Error

Chris Shull's "Get Lyrical" script -- v2.3 was posted yesterday -- apparently only retrieves lyrics for "Billie Jean" by Michael Jackson. I have contacted Chris about fixing it.

Update: Apparently there are some other problems with the script. After editing it myself to fix the "BJ" problem, I was unable to get correct lyric text for very many song selections. Again, I have notified Chris.

July 3 2007 - 1:40 pm

Proximity + iPhone

Proximity is an application (menu bar app, actually) that monitors the proximity of your mobile phone or other bluetooth device and executes custom AppleScripts when the device goes out of range or comes into range of your computer. Guess what? Couple of geniuses have written some example scripts for it that work in conjunction with iPhone.

July 2 2007 - 12:10 pm

iTunes Maintenance

Perhaps you change your car's oil on a regular schedule (you should). You pay bills on a regular schedule. Perhaps you have other household routines you schedule on a regular basis--cleaning bathroom, changing sheets, clipping the dog's nails, weeding the garden, Swiffering the computer desk, and so on.

How about tending to your iTunes music collection?

Many people who frequent this site are looking for AppleScript solutions that will instantaneously completely transform their un-tidy iTunes Library into a pristene-perfect Library of Congress-quality digital music collection. To the contrary, I've found that there's no need to try and get iTunes maintenance done in one fell swoop. If you take your time to manicure your iTunes music regularly you will not only avoid frustration but maybe get to know your collection better.

I spend only about a half-hour a week pruning, updating, re-tagging, deleting, Smart Playlisting.... Usually, the best time for me is on Saturday morning. Just after the second cup of tea and before my wife announces (decrees) the Weekend Activities. Here's my regimen:

  • Find duplicates - Using either iTunes' own "Show Duplicates" or Dupin, I assemble a list of possible duplicates. This assemblage contains the (so-called) "original" track and the (so-called) duplicate(s). I actually listen to a portion of each track, and/or check the bit rate and sample rate, and/or do a "Get Info", and/or check the file (using "Show In Finder", Command/R) to make sure which is the "original" and which is/are the "duplicate/s". Delete accordingly. (See iTunes Help Menu "Keyboard Shortcuts" on how to delete tracks/files from a playlist.) Remember, I don't check every track since I only have a half-hour on Saturday before wife says clean garage.
  • Check for empty tags - Do a sort by Album. Find tracks with blank albums. Do a sort by Artist. Find tracks with blank Artists. And so on with other tags. Correct, if necessary.
  • Check Artwork - I use artwork tool in TrackSift. Then I use Find Album Artwork with Google to locate artwork. Of course, you can always use iTunes own "Get Album Artwork" in the Advanced Menu.
  • Examine playlists - I'll often create temporary playlists (Smart and regular) and then forget about them. Now's the time to get rid of them.
  • Archive TV Shows and Movies - I subscribe to several TV Shows. When the season ended for "Ugly Betty" and "My Name Is Earl" I dumped the shows to DVDs and deleted the files from iTunes. Likewise, I delete episodes of "The Daily Show" after a couple of weeks; since they are so topical, unless there is a real keeper, they get deleted.
  • Always sort by Date Added - All my main libraries (Music, TV Shows, Audiobooks, and so on) are sorted by Date Added (newest on top) so I only have to scroll to the bottom to find out What The Deal Is. Archive 'em or delete 'em.

I certainly do other tasks which are me-specific, but the point is to do them regularly. Otherwise your library will almost certainly get out of control. Remember, you don't have to fix everything this Saturday. Take it one Saturday at a time.

July 2 2007 - 7:06 am

iTunes 7.3 - Bundled Apps

Last August, this article at Mac OS X Hints pointed out the differences between AppleScript Application and Application Bundles running on PPC and Intel Macs. At the time, I asked if Bundles displayed and worked correctly in iTunes' Script Menu on an Intel Mac--they did not. However, the original poster, Harry Dymond, just emailed me to let me know that iTunes 7.3 (and/or perhaps OS 10.4.10) resolves this issue.

June 30 2007 - 9:18 am

iTunes 7.3 - OSTypes Switched

A couple of Correspondents have noted that the OSType associated with the persistent ID property has changed to 'pPIS', which returns the persistent ID as a string. The previous OSType 'pPID' now returns a 64-bit number as in iTunes 7.1.1 and earlier. If you use raw Apple events to get this data then you may have to make some changes. (Thanks Milo and Manfred.)

June 29 2007 - 11:27 am

First Perusal of iTunes 7.3

As far as I have been able to tell, there are no AppleScript enhancements in iTunes 7.3. The iPhone, presumably, will display as a Source (like iPod) and (like iPod) audio files on the device will not be directly accessible with AppleScript. Since I have no plans to purchase an iPhone anytime soon, I'd be interested to know if AppleScripts such as Import iPod Audio Files work with iPhone. Then again, iPhone has its own OS, so file management may be completely different than with the iPod.

June 20 2007 - 4:31 pm

NEW: Nudge Stream URL

Nudge Stream URL is a stay-open applet that will attempt to keep the currently playing radio stream active. If the stream drops out, or another track is selected, the applet will re-open the stream's URL.

June 13 2007 - 6:31 pm

FastScripts

I recently got an email nudge from developer Daniel Jalkut. He's the developer of the application FastScripts, among other things. He noticed that I provide instructions for setting keyboard shortcuts for iTunes scripts and thought I'd be interested in FastScripts. I admit that I have known about FastScripts for awhile but never got around to trying it out. Well, I finally did. FastScripts goes the Apple Scripts Menu one or three better. It supports keyboard shortcuts for AppleScripts in its menu (both application-specific and global) and has the nice effect of taking place as soon as you set a shortcut value (without having to re-start an application like you would have to do if you set shortcuts in Apple's Keyboard Preferences), and will also allow you to set shortcuts globally. FastScripts is shareware, but FastScripts Lite is free and will let you work with ten scripts. I highly recommend it.

May 31 2007 - 9:36 am

Locate .itc Artwork files

On the iTunes 7.2 info page, I've added a ham-handed script that will get the path to a selected track's .itc artwork file. It uses the persistent id properties of the current library and selected track to create the filename of the .itc file (eg: 855D16966D2635AE-E345A3A7AC7E50AF.itc), and UNIX find command to locate that file within the ~/Music/iTunes/Album Artwork folder. It then reveals the file in the Finder. Of course, more could be done with it, like converting to PNG or some such, more error checking, and so on. I've just been too busy to do much more with 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.