Jump to content

iTunes and Javascript

- - - - -

  • Please log in to reply
1 reply to this topic

#1
cpking

cpking

    Newbie

  • Members
  • Pip
  • 1 posts
Please pardon the infantile post-I'm completely poleaxed when it comes to Java, and have a basic understanding of HTML, so just looking for a bit of help.

Below is a .js I borrowed and am trying execute the script, except I also want an input form to popup asking for the comments I want appended to the iTunes comment field. I have no idea what I'm doing wrong. Any help is appreciated.

var ITTrackKindFile = 1;
var objApp = WScript.CreateObject("iTunes.Application");
var tracks = objApp.SelectedTracks;
var numTracks = tracks.Count;
var name = mycomment ("Enter comment", "Type the comment here");
var i = 0;

while (numTracks != 0)
{
var currTrack = tracks.Item(numTracks);

if (currTrack.Kind == ITTrackKindFile)
{
var storedComm = currTrack.Comment;
if (storedComm.match(/ mycomment /i) == null)
currTrack.Comment = storedComm + mycomment ;
}
numTracks--;
i++;
}
WScript.Echo ("The text has been appended to Comments.");

#2
mr mike

mr mike

    Learning Programmer

  • Members
  • PipPipPip
  • 96 posts
I dont know much about javascript except that your problem may be here
currTrack.Comment = storedComm + mycomment
Change "mycomment" to "name" and see what happens because name is the variable that stores mycomment.

Side Note:
JavaScript(scripting language) has no affiliation to Java(programming language) except name. You probably haven't been getting a response because this is a java help forum. This site does have a javascript forum though.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users