Disable Track by Date

This script disables tracks in the current playlist by comparing a date entered in the track’s “Comment” field (MM/DD/YY) to the current date. It’s purpose is to remove announcements touting events on the last day of said event. This is my first attempt at AppleScript, and while this works, I’m sure there’s a more elegant way to script this tool. I welcome all suggestions, critisisms and help anyone is willing to offer.

OS version:

(*
Disable Track by Date
By Eric Myers
LarvaMoose Productions
07/29/03
*)

set todaysDate to (current date)
set thisYear to the year of todaysDate
set thisMonth to the month of todaysDate as string
set thisday to the day of todaysDate as string
log thisYear
log thisMonth
log thisday
set thisYear to text 3 thru 4 of (thisYear as string)
log "2 Digit Year = " & thisYear



tell application "iTunes"
	set myPlaylist to (get name of (get view of front window))
	log myPlaylist
	set trackCount to count of file tracks of playlist myPlaylist
	log trackCount
	repeat with tn from 1 to trackCount
		set thisTrack to (get track (tn) of (get view of front window))
		set myTrackName to name of thisTrack
		log myTrackName
		set myComments to comment of thisTrack
		log myComments
		
		--Check track for info in "Comment" field------------------------------------
		
		if myComments ‚ "" then
			set trackMonth to text 1 thru 2 of (myComments)
			log trackMonth
			set firstDigit to text 1 of (trackMonth)
			
			if (firstDigit as string) = "0" then
				log "take away the zero"
				set trackMonth to text 2 of (trackMonth)
			end if
			
			--pull todays date and change month to numeric value------------------------------
			
			if thisMonth = "January" then
				set thisMonthNum to 1
			else if thisMonth = "February" then
				set thisMonthNum to 2
			else if thisMonth = "March" then
				set thisMonthNum to 3
			else if thisMonth = "April" then
				set thisMonthNum to 4
			else if thisMonth = "May" then
				set thisMonthNum to 5
			else if thisMonth = "June" then
				set thisMonthNum to 6
			else if thisMonth = "July" then
				set thisMonthNum to 7
			else if thisMonth = "August" then
				set thisMonthNum to 8
			else if thisMonth = "September" then
				set thisMonthNum to 9
			else if thisMonth = "October" then
				set thisMonthNum to 10
			else if thisMonth = "November" then
				set thisMonthNum to 11
			else
				set thisMonthNum to 12
			end if
			
			
			--Compare Month & Day---------------------------------------------------
			
			if (trackMonth as string) = (thisMonthNum as string) then
				set trackDay to text 4 thru 5 of (myComments)
				log "here I am"
				log trackDay
				set thisday to the day of todaysDate as string
				log thisday
				
				
				--Compare Year-----------------------------------------------------
				
				if (trackDay as string) = (thisday as string) then
					log "This Year=" & thisYear
					set trackYear to text 7 thru 8 of (myComments)
					
					
					--if dates match, disable track-------------------------------------
					
					if (trackYear as string) = (thisYear as string) then
						set enabled of thisTrack to false
						log thisTrack
						--This section disables the following track since we run 30 sec. -----------
						--of silence between announcements.  Remove the following three-----------
						--lines to limit the disable feature to only the one track.------------------
						set thisTrack to (get track (tn + 1) of (get view of front window))
						set enabled of thisTrack to false
						log thisTrack
					end if --Date Match
					
					
				end if --Year Match
				
				
			end if --Month & Day Match
			
		end if --Check Comments
		
	end repeat
	
end tell