How to launch an application with JavaScript |
| Software - Tweaks | |
| Written by Michael D. | |
|
Insert the code bellow in the <body> of your HTML file.
<SCRIPT Language="JScript">
It creates a function that can be launched from a link for example in your HTML code (in our case runcmd). This will run the File variable that must be set - i used cmd.exe in my example. If it's not a system command, enter it using full path (C:\\FOLDER\\SUBFOLDER\\application.exe for example).
<body onLoad="javascript:runcmd();"> Note that due to security riscks, usually a confirmation dialog will appear before running the application requested. The script works well on Internet Explorer. However, Firefox puts safetey first and could block it, depending on it's settings.
written by gumi , December 23, 2007
I want to learn more about javascript
written by Adept Infotech , January 27, 2008
I want to Know the difference between havascript and javascript 1.0
written by Confused , March 05, 2008
How can you run an application from a USB drive. i.e. if I have a .html page on a flash drive and I want to use this javascript within that webpage to launch a java program also stored on the USB flash drive. the FILE="cmd.exe"; looks on the computer, how do you change this to look in the USB drive where the .html page this javascript code is running from is stored? Thanks
written by hamza , June 17, 2008
hi , i like this but how i can remove the confirmation messeg window before running the application requested and run directely my application requested
written by Andy Vogt , August 07, 2008
What if you are trying to run something from c:Program Folders and the long filename is giving you issues. Adding quotations around the entire string does not seem to work. Any suggestions?
written by Nabeel Salie , November 06, 2008
for long filename: use the property ShortPath once you the folder object, then use the shortpath with the file you trying to run. launch application from USB drive - not quite sure if this will help, but to get the path where the a script runs from, try the following: var sPath = WScript.ScriptFullName.split(":")[0] ":"; var sNew = fso.GetAbsolutePathName(sPath); hope this helps
written by RaviYadav , November 23, 2008
function runcmd() { File="cmd.exe"; WSH=new ActiveXObject("WScript.Shell"); WSH.run(File); } above script is only able to run .exe file existing in c:windows directory. But i want to run powerpoint having its powerpnt.exe file in C:Program FilesMicrosoft OfficeOFFICE11 directory. To to run this application i must have set the envaronment variable as PATH=C:Program FilesMicrosoft OfficeOFFICE11 directory, after it i can cun WSH.run("powerpnt.exe");. how can i set, and run.
written by rubina , April 04, 2009
Hi I want to know how to run an exe file from a web page. Does anyone know?
written by thecomputerguy , May 22, 2009
Use original script change File="cmd.exe" to File"powerpnt.exe"
written by Hariharan , June 24, 2009
I want to know how to launch an exe using javascript from MAC OS. The exe which i want to execute is a desktop application in MAC OS. WSH=new ActiveXObject("WScript.Shell"); WSH.run(File); The above 2 lines throws an exception in MAC OS. Do you need more help? Ask now!
|
|
| Last Updated ( Sunday, 22 April 2007 ) | |