Archive for the
‘Managing Files’ Category

November 8 '14 - 2:42 pm
Latest Batch of Updates

So busy slapping ’em together that I hadn’t posted I’d updated ’em. Here’s the last few updated scripts (October 29 – November 8):

Set Video Kind of Selected v5.0 – change the video kind property of the selected tracks to your choice of “Home Video”, “Movie”, “Music Video” or “TV Show”. Additionally, “Show Name”, “Season Number”, and incremental “Episode Number” can also be set or cleared for each selected track.

Convert and Replace v2.0 – convert the selected tracks using an encoder chosen on-the-fly (the encoder’s current Preferences-set options will be in effect) and replace the originals throughout the playlists of your entire library with the newly converted versions. Additionally, you can opt to Trash/delete or keep the original files and tracks.

Trackographer v4.0 – stay-open applet will monitor iTunes and send tag and time-of-play information of each track that plays (including iTunes Radio and internet radio streams if they provide track info) to a text file. Preferences can be set to include or not include various basic tags and to create a plain text file or a tab-delimited text file which can be imported into a spreadsheet.

Multi-Item Edit v2.1 – mostly bug fixes; edit most track tags (and some additional options) in a single window which emulates the pre-iTunes 12 “multiple items” format; that is, a checkbox adjacent to each tag allows you to select which changes are to be applied to the selection’s tags.

Delete Selected Files v2.0 – remove each selected track from all playlists and Trash or immediately delete their corresponding files. Some iTunes delete commands will not move files from outside the “iTunes Media” folder to the Trash. This script worksaround that.

Find Truncated Tracks v2.0 – assists with segregating iTunes Match tracks that appear to get cut-off when played (due to a possible bug which Kirk describes here). Then these truncated tracks can be deleted and re-downloaded intact (by you, not the script).

Playlist Manager v2.0 – iTunes only allows one playlist to be selected at a time. This applet can perform common useful tasks on a multiple selection of playlists: rename (add text, remove text, search and replace text), duplicate, delete, export, merge.

Search Results to Playlist v2.0 – search a chosen category (Library, Music, Movies, etc) or the selected playlist for user-entered text by All, Song, Artist, Album, or Composer tag and copy the track results to a Search Results playlist, which will be created automatically if necessary. Can optionally re-create or append to the Search Results playlist on each run. Floats over iTunes while active for easy access.

October 7 '14 - 2:27 pm
UPDATED: Music Folder Files Not Added v4.1

Music Folder Files Not Added v4.1 will list the file paths of the files in your designated “iTunes Media” folder which are not in iTunes’ track 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, move them to the Trash, and export a text file listing the file paths.

This latest version has additional support for OS X 10.10 Yosemite.

See the video on YouTube.

June 4 '14 - 1:39 pm
NEW: Track CPR

iTunes will let you re-associate a file with a single selected dead track.

This really is the safest way for iTunes to do this. The user approves a one-to-one correspondence with a user-selected track and a user-chosen file. If an error choosing the correct track/file pair is made, the user made it, not iTunes. Still, being able to point an album’s or artist’s worth of dead tracks at a folder of corresponding files seems like it would be a simple task, though in practice perhaps not always one-hundred percent fool-proof.

I’ve been putting off building something like that for a long time because of the fool-proof factor. It’s restrictive and awkward to make a one-size-fits-all tool without including a lot of options to account for idiosyncratic ambiguities that ultimately may generate more support issues—to put it politely—than I would like to handle.

With compromise and limitations in mind, I’m posting Track CPR, a script that assists with batch re-associating files with dead tracks.

And, in the interest of avoiding as many support issues as possible it’s somewhat narrowly focused; while this script will do a lot of the work for you, it can’t make a lot of decisions for you. Therefore you may find it tedious.

But not as tedious as clicking the “Locate” button 200 times:

So here’s how it works:

March 16 '14 - 12:18 pm
Reveal Multiple Selected Tracks’ Files

I occasionally have need to access the files of tracks that may not always be in the same “Album” folder. iTunes has a “Show in Finder” command (Shift-Command-R) for single tracks so to reveal all the files from disparate folders I have to “Show in Finder” each of the tracks, one at a time.

But what if I could open each selected track’s file’s folder in its own tab in a single Finder window? Like this:

Each tab is the containing folder for the file of each selected track and each file is highlighted. Even if two or more files are in the same folder the folder will get its own tab for each file.

The script follows:

February 5 '14 - 10:30 am
NEW: Export Files From Playlists

Export Files From Playlists—playlists, plural—will export copies of the files of the tracks in a selection of playlists to a single user-selected folder.

More information and download is here.

December 20 '13 - 10:47 am
UPDATED: File Renamer v2.4

File Renamer will rename the files of the selected tracks (or the files of the tracks in the selected playlist) with a filename pattern that is formulated using the tracks’ tag data. Optionally, export a copy of the files to a chosen location and rename the files in that location.

This latest version supports literal bracket characters (ie: [ and ]) and provides a [play order] pattern “field” which will match the index of each selected track in its sorted order.

More information and download is here.

December 14 '13 - 1:36 pm
UPDATED: PDF Adder v4.2

PDF Adder is a collection of two scripts (it used to be three) that assist with adding PDF files to iTunes as “digital booklet” PDF tracks. Each provides a method for easily supplying Author (artist), Album, Category (genre), Year, Rating and Description tag data which is then applied to the newly-added PDF track entry:

  • Add as PDF to iTunes is a PDF Service workflow that, when installed, will be available in the PDF pop-up menu of the Print Dialog. It allows you to save the current document as a PDF file (from any application that uses the Print Dialog) and add it to iTunes.
  • PDF Adder is an applet/droplet that will let you choose or drag-and-drop an existing PDF file and add it to iTunes. It can be installed in iTunes’ Scripts folder for easy access from iTunes Script menu.

Each script displays a panel like this so you can provide tag data for the PDF:

Anything you can print, you can export as a PDF…and any PDF can be added to iTunes.

These latest versions are updated for compatibility with OS X 10.9. I also got rid of PDF Dropper and just made PDF Adder launch via double-click (or Script menu launch) or by drag-and-drop. Finally, Add as PDF to iTunes will use applicable tag data for the PDF metadata tags Title, Author, Keywords (Category/Genre tag) and Subject (Description tag).

I almost included an option to add PDFs to iBooks (see below, “iBooks is Not Scriptable. Much.“) but iBooks ignores PDF metadata except for Author and of course prevents “tag” editing in the app itself. You can drag PDFs from iTunes to iBooks and the name and artist/author tags will be copied to Title and Author correctly, but that’s insufficient for me. I prefer the bevy of tags available for PDF tracks in iTunes.

Deal-breaker for some: under Mavericks, with iBooks installed, PDFs added to iTunes are put in the Music library. Under earlier OS’s, iTunes puts them in Books or Audiobooks.

More information and download here.

November 6 '13 - 8:18 am
Add Files in Reverse, Sort by Date Added

A Correspondent writes that he sorts his Music library playlist by Date Added and meticulously adds each new album’s worth of files to iTunes in reverse order—one file at a time—so that an album will appear in order (well, the order established for them in the Finder); older tracks appear sorted lower in the Music library playlist than newer tracks. Get me?

Predictably, Our Correspondent is dismayed by the drudgery of this method and inquires if AppleScript can provide any relief. AppleScript provide relief from drudgery? Ahoy!

tell application “Finder”

set selectedFiles to selection

repeat with i from (length of selectedFiles) to 1 by -1

my addFile(item i of selectedFiles)

delay 1

end repeat

end tell

to addFile(aFile)

tell application “iTunes”


add aFile as alias

end try

end tell

end addFile

Save this as a Script Bundle—named whatever you like—to your ~/Library/Scripts/ folder. This will make the script available in the system-wide Scripts menu at the right side of the menu bar. Select the files in the Finder you want to add, which have been sorted in the order you want, and launch the script. It will add the files to iTunes in reverse order so that when they are sorted by Date Added in iTunes they appear in the order you had for them in the Finder.

UPDATE November 11, 2013: Added 1 second delay in repeat loop to prevent tracks from having the same date added (to the second) and sorting arbitrarily.

May 31 '13 - 12:41 pm
UPDATED: File Renamer v2.3

File Renamer will rename the files of the selected tracks (or the files of the tracks in the selected playlist) with a filename pattern that is formulated using the tracks’ tag data. Optionally, export a copy of the files to a chosen location and rename the files in that location.

This latest version will format date properties as YYYYMMDDHHMMSS.

More info and download here.

May 22 '13 - 6:20 pm
NEW: ConvExp to Album Folders

In my (seemingly never-ending) quest to get music into my car like a Regular Person I found that if I fill a USB stick with audio files in Artist/Album folders my car’s audio system will occasionally work right. The script Export to Album Folders does this. Then I realized that I had a lot of Apple Lossless files which I’d have to convert to MP3 before dumping them to the stick. But that leaves the superfluous converted tracks and their files in iTunes’ library which I’d have to remove using my hands.

ConvExp to Album Folders (Convert and Export to Album Folders) takes care of converting selected tracks, moving the converted files in Artist/Album folders to a selected location, and removing of the converted effluvia from iTunes.

A couple of Correspondents inquired about doing something like this, so I hope they and you find it useful.

More info and download here.

Site contents © 2001 - 2015 (that's right: 2001) Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no affiliation with Apple, Inc.