March 16 2014 - 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:

tell application "iTunes"

set sel to (get a reference to selection)

if sel is {} then


end if


set theLocations to (get location of sel)

on error


end try

end tell

tell application "Finder"

set firstOneDone to false

repeat with i from 1 to (theLocations's length)

set thisAlias to item i of theLocations

if thisAlias is not missing value then

## just open the windows as necessary, no tabs behavior:

-- open thisAlias's container

## or, reveal each file in its own tab in a single window: 

if firstOneDone then

tell application "System Events" to keystroke "t" using command down

delay 0.2 -- helpful, u may need to increase

set target of front window to thisAlias's container

reveal thisAlias


make new Finder window

set current view of front window to list view --  or icon view; NOT column view

set target of front window to thisAlias's container

reveal thisAlias

set firstOneDone to true


end if

end if

end repeat

end tell

Save this with a format of "Script" and named whatever you like to your ~Library/iTunes/Scripts/ folder. To use it, just select some tracks in iTunes and launch the script from the iTunes Script menu. I wouldn't select too many tracks.

Yes, it uses System Events and GUI scripting to create each new tab so you may have to set some Accesssibility options in System Preferences.

If you prefer, you can change the current view setting from list view to icon view. Using column view screws things right up.

I found the delay statement was helpful if the Finder wasn't spry enough grabbing the folder. You may need to increase it if a new tab doesn't get the folder fast enough and continues to display the default window contents (like your home folder or whatever it may be).

I've also included a line that will just open each window instead of the single window with tabs. If you'd rather use that then comment-out/un-comment the appropriate sections.

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