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


Click here to return to the 'Correction: Tag tracks in iTunes with Quicksilver' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Correction: Tag tracks in iTunes with Quicksilver
Authored by: jedverity on Sep 04, '08 12:19:07PM
Sorry for the grouping issue (from the last reply). Here is the corrected script:
property tag_prefix : ""

using terms from application "Quicksilver"
	on process text txt
		set txt_items to my itemize(txt, " ")
		set tags to my wrap(txt_items)
		tell application "iTunes"
			set t to current track
			set g to t's grouping
			if g ≠ "" then
				set tags to my compare(g, tags)
			end if
			set t's grouping to g & my itemize(tags, "")
		end tell
	end process text
end using terms from

to itemize(var, delim)
	set delims_old to AppleScript's text item delimiters
	set AppleScript's text item delimiters to delim
	if var's class = list then
		set txt to var as text
	else
		set txt to var's text items
	end if
	set AppleScript's text item delimiters to delims_old
	return txt
end itemize

to compare(tags_old, tags_new)
	set tags to {}
	repeat with i in tags_new
		set o to offset of i in tags_old
		if o = 0 then
			set end of tags to i
		end if
	end repeat
	return tags
end compare

to wrap(array)
	set output to {}
	repeat with i in array
		set end of output to (tag_prefix & i & tag_suffix) as string
	end repeat
	return output
end wrap
       set end of output to (tag_prefix & i & tag_suffix) as string
   end repeat
   return output
end wrap


[ Reply to This | # ]