AppendToComment.js
Tags: Track Comments
Added On: 20th Jan 08
Links: [site] [download]
This script adds chosen text to the end of track comments for the songs selected. It does not erase or overwrite existing comment text, and it will not add the same text that is already in the comment field.
Script by [LiquidParallax].
With tracks that are highlighted (selected), it adds user-defined text to a comment without erasing and overwriting previous comment text. It will not add the same text that is already in the comment field (so if you have “live” already written in the comments and are adding “live” with this script it will only have one occurrence of the word).
- Remember to replace “your appendage” (two occurences) with a word or phrase that you want to use.
- If a track comment already contains “your appendage”, it will be skipped.
- This could be useful for adding “live” to the comments of selected tracks, for instance.
var ITTrackKindFile = 1;
var objApp = WScript.CreateObject("iTunes.Application");
var tracks = objApp.SelectedTracks;
var numTracks = tracks.Count;
var i = 0;
while (numTracks != 0)
{
var currTrack = tracks.Item(numTracks);
if (currTrack.Kind == ITTrackKindFile)
{
var storedComm = currTrack.Comment;
if (storedComm.match(/your appendage/i) == null)
currTrack.Comment = storedComm + " your appendage";
}
numTracks--;
i++;
}
WScript.Echo ("The text has been appended to Comments.");


Hi, I am looking for a way to view the location (full path) of my files in the normal list view of iTunes 9 for windows. Is there a way to add the location path to the comments tag, and ……… can you tell me how? :-)
Trying to use the appendtocomment.js script, but get an error from itunes. Any ideas?
Line: 2
Char: 1
“could not locate automation class named “iTunes.Applicaiton”.
Copde 80020009
Source: WScript.CreateObject
I think this error comes up regardless of what script you run. I’ve been googling for days trying to find out what the deal is…
I’ve created a vbScript similar to AppendToComment.js at http://samsoft.org.uk/iTunes/scripts.asp#KeywordsToComments
Unlike the original script here you will prompted for the keywords to add each time and the script will also parse a keyword of and insert the actual file location into the field instead.
tt2
Ah, I see there is a missing word in my previous post – if you set the keyword as the word “Location” (case sensitive, no quotes) surrounded by less than/greater than symbols then the file location gets inserted. I guess this site’s software thought I’d entered an html tag.
tt2
Hi turingtest2, thanks for the link; however, I still get an error (below). Any direction to point me in?
Script: c:\users\clayton\downloads\KeywordsToComments.vbe
Line: 138
Char: 3
Error: ActiveX component can’t create object: ‘iTunes.Application’
Code: 800A01AD
Source: Microsoft VBScript runtime error