Find a Track’s File Path
Display a track’s file path without a lot of mouse-clicks and open windows.
Tracking down the location of a track’s file can lead to having a lot of Finder windows open, especially if you’re using the Show Song File command a lot. This hack adds a simple step: it displays the file path of the selected track or currently playing track in a dialog box. Then, going Get Info one better, you can choose to show the file in the Finder only, which saves a few mouse clicks.
The Code
This script will get the location
property of a single selected file
track or the currently playing file track and display it in a dialog box. Additionally, the dialog box
buttons will allow the user to choose to reveal the file in the
Finder:
tell application "iTunes" -- routine to select single selected or playing track if selection is not {} and¬ (kind of container of view of front window) is library then set sel to item 1 of selection set dd_message to "selected track" else if player state is not stopped then set sel to current track set dd_message to "playing track" else display dialog "Select a library track." buttons {"Cancel"}¬ default button 1 with icon 2 giving up after 15 end if end if -- get the location property of the track if sel's class is file track and¬ sel's location is not missing value then try set the_file_path to sel's location on error errText display dialog errText ...
Get iPod and iTunes Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.