Hi! I’ve been learning Applescript for a few days now, and I decided to make myself a program to test out my new set of skills. I had two goals for the program. First, I’m rather anal about tagging my music correctly. I like to have the year of the album placed at the beginning of the album ID3 tag slot so that they arrange themselves chronologically both in iTunes and on my iPod. I wanted to create a droplet which would take the year of the album and place it at the front of the album tag. In this, I have been successful. However, it is my second goal which alludes me.
Because a lot of the music I listen to is downloaded, the folders often come with .m3u playlists for that album. This annoys me, because when I drag the folder into iTunes, all of the files go into the library twice (once for the actual file, and once more because of the .m3u). My second goal was to be able to drag folders of music onto the droplet, while having it discriminate against those .m3u files. Something about the nature of droplets, lists, and aliases is preventing me from doing this, however. I’ve tried many different ways to get this to work, but nothing seems correct. What I have now seems to be a little primitive, but I do not understand why it still wouldn’t work. Any help that you guys can offer would be extremely appreciated.
Here is the part of the code that deals with the .m3u files:
on open Album_Fixer
tell application "Finder"
set SongList to {}
set adrop to {}
set bdrop to {}
set cdrop to {}
set ddrop to {}
repeat with a in Album_Fixer
if folder of (info for Album_Fixer) then
set adrop to item a of Album_Fixer
repeat with b in adrop
if list then
set bdrop to item b of adrop
repeat with c in bdrop
if list then
set cdrop to item c of bdrop
repeat with d in cdrop
if list then
set ddrop to item d of cdrop
repeat with e from 1 to (count of ddrop)
if name of ddrop's item e does not end with ".m3u" then
set end of SongList to ddrop's item e
end if
end repeat
else
if name of cdrop's item d does not end with ".m3u" then
set end of SongList to cdrop's item d
end if
end if
end repeat
else
if name of bdrop's item c does not end with ".m3u" then
set end of SongList to bdrop's item c
end if
end if
end repeat
else
if name of adrop's item b does not end with ".m3u" then
set end of SongList to adrop's item b
end if
end if
end repeat
else
if name of Album_Fixer's item a does not end with ".m3u" then
set end of SongList to Album_Fixer's item a
end if
end if
end repeat
end tell
-- More code here
end open
By the way, the reason for all the repeat loops is so that I could deal with, in theory, files that were as many as five folders down.
Again, thank you for any help you can offer.