Running command prompt insite website - javascript

I want to run command prompt inside the website.
Actually I want to use Jemdoc in my website. Jemdoc generates an HTML website if you run in command prompt the command "jemdoc index". I want that when you click a button! I dont know how to program in PHP or c#.
Can I do that in JavaScript?
If you could give me an example will be great (JavaScript or not)!!!

the Browser can not execute arbitrary commands on the clients system for very good reasons.
In short, you need a server for this! This can be PHP, Java, NodeJS or whatever. Your website sends a trigger (ie HTTP-POST) to the Server and it executes jemdoc (also installed on the server) for you and updates the html documents.
Greets

Related

I am trying to use a locally hosted Django webserver's HTML button to execute a python script that's on my local machine and I'm stumped

So, I'm pretty new to Django, python, and javascript.
I have a partially functional Django webserver that, while developing it, I host locally on my machine.
I've made a button with HTML which I've figured out can be tied to a javascript script. The next step for me was to make this button "execute" a python script that's sitting on my machine, particularly on the /desktop directory. I can of course move the script though, but the important part is that I want that python script (let's call it django_test_script.py) to open its own window on my machine. It's just a file that says "hi" in stdout, then closes after 5 seconds, but due to the plan for this whole project, I want that to happen. I want to have my website open on my machine, click that button, then have the script's console pop up on my desktop and run/finish.
The eventual goal is to control an LED strip that's plugged into my raspberry pi. I want colored buttons on the website that, when clicked, run appropriate python scripts that turn the lights to that color. It wouldn't take me long to write up the python scripts themselves that would change colors, but I need to bridge the gap between "button causes a py script to run" and the python script actually running.
I see a ton of questions similar to this, but they all seem to involve running the python scripts WITHIN the webserver, like internal files that do everything and then return something to the server via an HttpResponse.
I don't need an HttpResponse. Literally all I want to do for right now is figure out how to make a script that's stored on the machine run.
I've done some reading on AJAX and I'm guessing that's involved, however everything I've tried has failed with AJAX in terms of actually getting the server to RUN a script. I've been scouring the internet for over an hour now and have found basically nothing useful (as far as I can tell) so I figured I may as well ask for help. Can someone please point me in the right direction in terms of what I'll need to do?
I'm afraid that's not possible. The browser doesn't allow to execute local scripts since everything is (for security reasons) in a sandbox.
If you want to execute something you could do one of the following:
Use a http server which executes the script and call it via AJAX
You build it into an exectron / nodejs app which opens more possibilities to access the system. See this example
But from your requirement I assume the website will be opened on another device to remote control the Pi led? If you you'll need to use some sort of http server as otherwise you can't run the script on the pi itself.

how am I going to test my node.js code in the browser?

newbie here.
So I have this button, when a user click on that button, a node.js fs function will execute and will create a new folder for me, that is the fs.mkdir() function,
the code is just simple, and works on the terminal too, but I do not want to work in the terminal anymore I want to test on browser, I want to bind html elements to nodejs, I am so confused right now, when I open my html file it gives me an error : "require is not define", I search and search for hours. and I realize that most of the tutorials online they test and run the code in the terminal so how does someone test on browser to know if their code works?
to summarize my problem, I just want to interact on html elements, and that elements will cause to fire a node.js functions, how do I test it in the browser?
Node.js is used to run javascript on a node server. It runs server-side
The browser plays the role of a client
If you want to click a button in the browser and then execute a function in nodejs as a result of the click, you need to know that the architecture is a client-server
You'll need to setup a nodejs server, maybe using express.js, and then you'll need to do maybe a form in html that sends an http query from the browser to the server, so that the server executes the script you want.

Execute Command (cmd) by Hyperlink or Javascript

I am looking for a way to make the client machine execute some command line in the command prompt (cmd) from a web page (intranet application).
I guess (and hope) this cannot be done by browser standards. But assuming I have full access to the clients' machines and can setup everything I need on them - Is there a way to make Internet Explorer trigger a launch of cmd and execute a given command? So I could then include hyperlinks or javascript to access it like, for example, this:
Click Me
executeCmd('C:\\Program Files\\...');
If there is no easy way to configure something like this, I'd be very thankful for workarounds or different approaches to trigger a command from a web page.
Instead of using
Click Me
executeCmd('C:\\Program Files\\...');
Use this
Click Me

javascript how to open a exe on server

im adding some functionality´s on me site and i would like to open some exe´s i have made using vb2010 ,the exe will me on my local server but the site will be hosted in a server some were in the world .
to execute the exe i just need to add boton on the site whit the path to the location of the file on my server? like
C:\folder\folder\myfile.exe
or there other more easy way to do this ?
thnx for any help
Put it this way, if you had such a button, what's to stop me passing rm /s/q C: and watching your entire hard drive disappear?
Instead, have a form with a <select> element that lists the programs you want to run as keys, such as myfile, then submit that to the server. Then have the server verify that the key is allowed, and if so run the corresponding program.
This is not possible directly, because it is not safe at all.
You have to do it on the serverside. Call a webservice function on the webserver that can make a call to the exe file.
Reference enter link description here
From your question I understand the web server and the exe are in two different networks. I assume both the servers don't have access to each other. If that is the case, you cannot execute the exe when the button is clicked on the page.
If the exe is on the client, then where the page is displaying then also you would not be allowed to execute it due to security sandbox model.

Print a webpage without any prompt? using javascript or jquery or vbscript

I want to print a webpage that resides inside my website using javascript or jquery or vbscript or any client side scripting language that can run on IE, without any prompt.
for example function should just take in the URL of page and send print command to the printer.
window.print(URL);
Thanks
This is impossible.
Allowing web pages to use ink and paper resource without permission would be an insane thing for a browser to do.

Categories