Jump to content

JS + command line


metadata

Recommended Posts

Hello, I am working on a project in which I need to out put text to the command line, as well as prompt for input from the command line. The application is to use JS and I'm looking for some reference materials on pulling this off. Any info is appreciated. Thanks!

Link to comment
Share on other sites

Are you using Node.js? if you're trying to do this from a browser that's not going to happen.
No it's not being done through the browser, it's more of a test application than a functional one. From the command line in Windows I'm using the cscript //nologo file.js command to run the application. I'm going to output the interactions within the file.js to a xml doc as a log eventually.
Link to comment
Share on other sites

Javascript running in a browser can't interact directly with the operating system. If you're just doing this for yourself then you can use ActiveX components, which are only supported by IE, and you'll probably need to set special permissions for your page to allow it to happen. http://www.itjungle.com/mpo/mpo052302-story01.html

Link to comment
Share on other sites

Is there a way to execute a js file without a browser? I'm talking straight from the Windows shell. Again this is for my use only, not to be used on a website or in conjunction with any kind of html.

Link to comment
Share on other sites

OK, so how do output back to that command line? For instance this block of code will output to an html doc, and then to the browser, for a user to see....

var prompt = "Hello, this is x calling.";			  //output prompt function S_Hello(prompt){  return prompt;											  } document.write(S_Hello);

However, I need code to output right to that command line/shell for the user to see the output and then enter in more further on in the program.

Edited by metadata
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...