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

Click here to return to the 'Import Songs into iTunes Playlist in Correct Order' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Import Songs into iTunes Playlist in Correct Order
Authored by: aca on Oct 12, '07 07:37:16PM

When dragging things from the finder into other apps (e.g., into an iTunes playlist), the order that you get depends on what view option you have your Finder window set to. If it's in column view, they should be added in alphabetical order. If it's list view, they come in some other order, which I've never been able to predict precisely (it depends somewhat on the order in which you selected the items, but there's also some other variable that I've never figured out) This "feature" has been around since the first version of OS X, I'm not sure if it's intentional or a bug...
When I drag things from the finder into iTunes, I always switch to column view first, so it's at least in alphabetical order.

[ Reply to This | # ]
Import Songs into iTunes Playlist in Correct Order
Authored by: twang on Oct 15, '07 09:06:47PM
Yeah, this problem annoyed me to no end. I keep my songs sorted by date added, so I hobbled this together. There is probably a better way, but it works like a charm... It lets you drag on a folder, and it sorts then by name and adds them successively ever 2 seconds. you hear the first second of each track as it plows through, opening each, and each is copied to the library.
on open theFolders
	repeat with theFolder in theFolders
		set folderInfo to info for theFolder
		if the folder of folderInfo then
			importAlbum from theFolder
			set folderName to displayed name of folderInfo as string
			display dialog folderName & " is not a folder."
		end if
	end repeat
end open

on importAlbum from theFolder
	tell application "Finder"
		set theSongs to every item of theFolder
		set theSongs to sort theSongs by name
	end tell
	repeat with theSong in theSongs
		set songName to the name of theSong
		set songFile to theSong as text
		set songTitle to getSongTitle from songName
		if songTitle is not false then
			--say "Importing song " & songTitle
			open theSong
			delay 2
			--say "Skipping file " & songName
			delay 1
		end if
	end repeat
end importAlbum

--filter the songName to mp3's only
on getSongTitle from songFileName
	set songTitle to false
	if songFileName contains "mp3" then set songTitle to songFileName
	return songTitle
end getSongTitle

[ Reply to This | # ]
Import Songs into iTunes Playlist in Correct Order
Authored by: Baby Bloc on Jan 14, '11 11:19:39PM
This worked pretty well for me. I did change the script to make it wait longer between imports. Just changed the "delay 2" to "delay 6." And the "delay 1" to delay 6."

I think iTunes is trying to import stuff alphabetically, but sometimes gets messed up when tracks take too long to start (long tracks, etc) and it gets one out of order once in a while. (This happens to me when I manually click on tracks to import them "in order." When I do it too fast, iTunes can't always keep up and puts a shorter one out of order before a longer one.)

So, I changed the script to add that longer wait, and then I saved it as an Application (that was important), and now I can drop folders from the finder into the application icon wherever I put it. It works pretty good. Thanks for that, it's bugged me for a long time.

I'm not sure if the "delay 6" will work with all tracks. I may have to mess with it if I'm doing some albums with really long and short tracks.

[ Reply to This | # ]
Import Songs into iTunes Playlist in Correct Order
Authored by: soundsgoodtome on Dec 07, '13 10:51:41PM
I pasted this into AppleScript Editor, compiled it, and saved it as an application — but it's not working. In the years since this was posted, has Apple made changes to AppleScript that would cause this to no longer work?

Also, with tracks in the Finder properly prefixed with 2-digit numerals, I'd like the script to import them in reverse order, so that they appear in correct order when sorting in iTunes by date added.

I'm no AppleScript expert, but I found the following command-modifier elsewhere in another script. Can someone tell me if changing...

set theSongs to sort theSongs by name


set theSongs to sort theSongs by reverse of name

…will do the trick?

UPDATE: Though I still wouldn't mind the answers to my questions above, I just found an AppleScript that does exactly what I want (imports tracks into iTunes in the order opposite the way they're currently displayed in the Finder):

Handy! (Obviously it could also be modified to import tracks without reversing them.)

Edited on Dec 07, '13 11:02:11PM by soundsgoodtome

[ Reply to This | # ]