Need Script to Automatically Relink Dead (!) Tracks to their Files

I have a bunch of videos that I store on an AirDisk, and whenever I sync my iPhone on the road, the videos I have loaded are displayed as dead since I’m no longer connected to my network. However, when I return home, the videos are not automatically reconnected to their files. Would someone help me create an AppleScript to automate relinking dead tracks to their files?

Hi,

take a look at this script from Doug’s AppleScripts for iTunes

I’ve looked at that script, but it requires going through the dead tracks one by one. I have hundreds of video files (Mostly TV shows), and relinking each one individually would take forever. Also, that script helps one find dead tracks. In my case, the files aren’t missing, they’re exactly where they should be, but iTunes couldn’t find them there once (when I was away from my network) and doesn’t try to look again when I return home.

I found this script online, but compiling your script, I get the error, “Expected end of line but found identifier,” and the second reference to “this_track” is highlighted.

tell application "iTunes" to activate
if selection is not {} then
set sel to selection
repeat with this_track in sel
refresh this_track
end repeat
end if
end tell

the first line must be splitted into two


tell application "iTunes"
	activate
	if selection is not {} then
		set sel to selection
		repeat with this_track in sel
			refresh this_track
		end repeat
	end if
end tell

Thank you for your replies.

Selected a dead track and ran the script. Script Editor produced the error, “iTunes got an error: Parameter error,” and the line “refresh this_track” was highlighted.

I doubt, that the refresh command can do what you want.
I there were any easy solution for this problem, you could find it on Doug Adam’s site.
He’s got solutions for all cases concerning iTunes

I have had these issues in the past when moving my iTunes library from one computer to another; there is no way to program the re-linking of the (!) tracks. You either sit there for hours doing it manually, or you do something else. Here are some of the other things that I have done:

–Purchase a shareware utility to rebuild my iTunes library from my iPod. I like PodWorks; you can preserve ratings and play counts and played dates, but NOT smart playlists.

–Copy all the tracks from the iTunes folders onto an external hard drive, delete the iTunes folder, and re-start iTunes, generating a clean database, and importing everything. This, of course, loses all your playlists, ratings, etc.

–Even with the (!) on the tracks, iTunes will generally return information about ratings, play counts, etc., so if that data is precious to you, I can provide you some AppleScripts to save that data before you clean everything out, and then after import, you run another script to restore the data.

–If your smart playlists are precious to you, you need to save the iTunes.plist file from your User Library (I think; it has been a long time since I had to do this) if you choose to do a complete erasure first. There is only one file that holds all the smart playlist data, and I think that is it. I may be wrong. Anyway, if you choose that approach, save that file, erase everything, and put the file back BEFORE importing the tracks again.

Hope this helps,