View Full Version : How can launch a clientside application in javascript

Frances Ford
01-20-2003, 05:50 PM
I have a web based application that displays an htm page to the client. Is it possible to have say a button for the user to press to run a local application and keep the htm open?

Also is it possible to display the printers that are available to that user by pressing a button and inserting on the current htm?

Thanks for help.

01-20-2003, 08:34 PM
no with javascript; maybe with ActiveX...

Graeme Hackston
01-20-2003, 10:49 PM
This doesn't fit your situation but you might find it of use.

As Borgtex suggested this is activeX (IE only). Notice that the paths are DOS paths. You can get those in Windows by looking at the properties of the file.

For local use, you won't get the activeX warning if you save the page as an .hta file (real simple) rather than .html

<script type="text/javascript">

fso = new ActiveXObject("Scripting.FileSystemObject");

function RunProgram(Program_Path) {
Default_Value = Program_Path.match(new RegExp("Default", "i"))
if (Default_Value) {
} else {
new ActiveXObject("WScript.Shell").Run(Program_Path,3,false)


<select onchange="RunProgram(this.value)">
<option value="Default" selected>Launch Program</option>
<option value="C:\\PROGRA~1\\MICROS~1\\MICROS~4.LNK">Word</option>
<option value="C:\\WINDOWS\\EXPLORER.EXE">Explorer</option>
<option value="C:\\PROGRA~1\\MOZILLA.ORG\\MOZILLA\\MOZILLA.EXE">Mozilla 1.0</option>


Frances Ford
01-21-2003, 11:32 AM
I don't know anything about WScript, but when I run the htm I get the message:
'The system cannot find the file specified'.
Any help appreciated.

Graeme Hackston
01-21-2003, 11:48 PM
If your using windows browse to, right click and select "properties" on each folder in the path to your .exe

In the window that pops up you'll see the following

MS-DOS name: some~DOSname .

Enter the DOS name of each folder in the path and finally the exec file between the double back slashes in the <option> value


more info on this here