Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Watch for a filename length issue in iTunes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Watch for a filename length issue in iTunes
Authored by: Frederico on Feb 10, '05 01:53:38PM
This should do it:

property longPlaylist : "_Tracks With Long Names"
tell application "iTunes"
	set thisPlaylist to view of front browser window
	if class of thisPlaylist is not library playlist then
		set z to true
		repeat with aTrack in (every track of thisPlaylist)
			set fileName to ((get aTrack's location) as text)
			set fileName to characters (-(offset of ":" in (reverse of every character of fileName as text)) + 1) thru -1 of fileName as text
			if (length of fileName) > 250 then
				if not (exists playlist longPlaylist) then
					make playlist with properties {name:longPlaylist}
				else if z then
					try
						delete every track of playlist longPlaylist
						set z to false
					end try
				end if
				duplicate (aTrack) to playlist longPlaylist
			end if
			
		end repeat
	end if
end tell


[ Reply to This | # ]
Watch for a filename length issue in iTunes
Authored by: DougAdams on Feb 10, '05 03:43:01PM

Of course. I scripted hastily!

Cheers.

---
Doug's AppleScripts for iTunes
http://www.malcolmadams.com/itunes/



[ Reply to This | # ]
Watch for a filename length issue in iTunes
Authored by: drewk on Feb 11, '05 01:25:32PM
Since the poster described the behavior of iTunes adding characters that then cause the filename to cross the 250 character limit, this line:

       if (length of fileName) > 250
needs to be:

      if (length of fileName) > (250-5)
to allow for the suffix on the name. Assumably 99,999 songs is enough ;->

drewk

[ Reply to This | # ]
Watch for a filename length issue in iTunes
Authored by: Frederico on Feb 19, '05 11:16:04PM

If you reread the OP, you'll see he notes a 255 character limit, standard for HFS+ under X, hence the >250 (251) character flag, which allows for the addition of up to four more characters safely.



[ Reply to This | # ]