开发者

How do I access a user's instance of iTunes using WScript run as SYSTEM user?

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开发者_如何学Python'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');


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜