Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mduser63

macrumors 68040
Nov 9, 2004
3,042
31
Salt Lake City, UT
iMeowbot said:
There is a track number field in the iTunes database. If you rip music from vinyl or tape, or from a CD that isn't in CDDB, it won't automatically be filled in. So, if you want to play that album in its original order, you have to fill in the numbers.

A little program to help with that task makes oodles of sense.

Here you go:

Code:
tell application "iTunes"
	if selection is not {} then
		copy (track number of selection) to theTrackCount
		copy selection to theTracks
	else
		return
	end if
end tell

copy theTrackCount's length to theTrackCount

repeat with i from 1 to theTrackCount
	tell application "iTunes"
		copy (a reference to item i of theTracks) to theTrack
		copy theTrackCount to track count of theTrack
		copy i to track number of theTrack
	end tell
end repeat
 

hob

macrumors 68010
Original poster
Oct 4, 2003
2,004
0
London, UK
mduser63 said:
Here you go:

Code:
tell application "iTunes"
	if selection is not {} then
		copy (track number of selection) to theTrackCount
		copy selection to theTracks
	else
		return
	end if
end tell

copy theTrackCount's length to theTrackCount

repeat with i from 1 to theTrackCount
	tell application "iTunes"
		copy (a reference to item i of theTracks) to theTrack
		copy theTrackCount to track count of theTrack
		copy i to track number of theTrack
	end tell
end repeat
Gee, thanks for spoiling months of intense research and development :p

But seriously, thank you! That's great, I can start looking at it and poking it around and stuff :)

Is there a way of integrating Applescript into a GUI?
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
hob said:
Gee, thanks for spoiling months of intense research and development :p

But seriously, thank you! That's great, I can start looking at it and poking it around and stuff :)

Is there a way of integrating Applescript into a GUI?

Yes, there is. Enjoy your 10 minutes of research. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.