Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 13th, 2006, 05:14 PM
Authorized User
 
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default launch executable from browser

hi all,

does anyone know how to launch an executable from a browser. I would like to launch an application that is loaded on the client's machine by clicking on a link or button on a page.

Any ideas are welcome,

thanks,

George.

 
Old July 15th, 2006, 05:49 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi George,
You would probably be better using wscript's shell method through vbscript for this. Here's an example of how to run notepad:

<script language = "vbscript">
sub nPad()
dim progName
progName = "c:\winnt\system32\notepad.exe"
set oShell = createobject("wscript.shell") 'create a shell

'***use the line below to call your app, defined above with the "progName" variable:
oShell.run(progName)
end sub
</script>

This example should get you started.

HTH
Cheers!
Joe

'sync' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
 
Old July 17th, 2006, 01:58 PM
Authorized User
 
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks Joe,

it works great, except for one little problem. It will not launch any executables the are stored in the Program Files directory or in any subdirectories. It works ok in all other directories. The app I plan to launch will be stored in the Program Files directory. There seems to be a restriction on the WshShell object from accessing this directory. Any ideas?

George.

 
Old July 20th, 2006, 03:09 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

George,

Whats the name of the app you want to launch?

Joe

'sync' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
 
Old July 20th, 2006, 12:26 PM
Authorized User
 
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Joe,
it's an application that I wrote, it's called WAMSTerm. I tried a few existing apps that were installed in the Program Files and none worked. I could try installing mine somewhere else but I typically store it there, under my company's name. It seems the Shell.Run is restricted from accessing the Program Files dirs.


 
Old August 1st, 2006, 10:45 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

More likely you need to enclose the path in quotes if it has spaces in it.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Executable - From Server KennethMungwira VB.NET 0 July 20th, 2006 02:33 PM
launch IE browser & control scroll bars ? gjelson VB How-To 0 March 15th, 2006 11:20 PM
Launch default browser in a new browser window haiying Beginning VB 6 1 August 30th, 2005 05:48 PM
Creating an executable Arsi C# 1 November 9th, 2004 06:45 PM
Tracing via executable bmains VB.NET 1 April 29th, 2004 02:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.