1
votes

I am trying to use JavaScript and the iTunes COM interface to add files to my iTunes library. I have written a JavaScript file that successfully adds a file to my library, but only when called from the command line.

When I run the same script from a browser, it creates an iTunes application as the SYSTEM user, and this is where I believe my problem lies...

So what I'm trying to accomplish is to access either the iTunes instance running under my user as opposed to SYSTEM user, or to add my user's iTunes library instead of the SYSTEM user's library.

Here is the JavaScript:

var iTunesApp = WScript.CreateObject("iTunes.Application"); 

iTunesApp.LibraryPlaylist.AddFile('B:\\filetoadd.mp4');
1
WScript is evil. Don't run that in the browser. Get the user to run something better like a perl script. or an exe.Raynos

1 Answers

0
votes

Windows scripting host is not really flexible enough to do this, so you would have to come up with some sort of hack:

  • Create a symlink from %windir%\system32\config\systemprofile\?path to itunes library? to your users library (iTunes is probably not designed to handle this and so it might not work or could break stuff)
  • Since you are running as SYSTEM you have a lot of power, you could schedule a task that runs your script with a special parameter as yourself and then control iTunes