Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 13th, 2006, 05:14 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old July 15th, 2006, 05:49 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
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.
Reply With Quote
  #3 (permalink)  
Old July 17th, 2006, 01:58 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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.

Reply With Quote
  #4 (permalink)  
Old July 20th, 2006, 03:09 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
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.
Reply With Quote
  #5 (permalink)  
Old July 20th, 2006, 12:26 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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.


Reply With Quote
  #6 (permalink)  
Old August 1st, 2006, 10:45 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:52 PM.


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