OS: windows 10
Node: v6.9.4
iTunes 12.5.5.5
I'm trying to write a node.js app that communicates with itunes, it will do a lot of things and i want to capture the response and show in a web page.
what i'm trying to do right now to understand this wscript thing is run a node file, that it will keep running to output on the 'change song' event some info about the tack.
After i did some research i made to a point, but now i'm stuck. I have no knowledge on windows ecosystem coding and is in this part that i'm struggling
searching the web i found this solution.
i don't find why i can on cmd use cscript o wscript but inside the .js file i need to use wscript
/* itunes open and playing a song */
var itunes = WScript.CreateObject("iTunes.Application");
var currentTrack = itunes.CurrentTrack;
WScript.Echo("name: " + currentTrack.Name + " artist: " + currentTrack.Artist);
open a cmd, go to that folder, and run
cscript /nologo myItunesScript.js
/* /nologo prevent to show some default cmd text*/
the program will run, output the music playing and it will close itself
If i do the same thing with wscript i don't know why but it show a popup window with the result instead of showing on the cmd screen.
On this page http://www.joshkunz.com/iTunesControl/main.html show a lot of things that i can do and even work with events.
I didn't find any app on npm that does some magic and makes my life easier.
So if someone can give some north, i will appreciate a lot.
EDIT: It is possible to connect to "iTunes.Application" without WScript from node?
If don't, is possible to listen for events from the output o WScript? (like in socket.io, you connect to someting and keep listening for things)

cscript.exeis the command line version of the WSH (Windows Scripting Host) whilewscript.exeis the GUI version. They are one and the same thing, just with different output. Example the codeWScript.Echo "Hello"incscript.exewill output to the command line while the same line executed withwscript.exewill output to a popup message.