What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Run programs with javascript

Run programs with javascript
Author: Message:
YottabyteWizard
Senior Member
****

Avatar

Posts: 709
Reputation: 23
37 / Male / Flag
Joined: Mar 2005
O.P. Run programs with javascript
A little help here...

I'm trying to code an HTML/Javascript page, where a link can open, for example, notepad.

using <a href="file:///c:/windows/system32/notepad.exe"> won't work, well at least I don't want the "Run/Save/Cancel" window to popup.

Searching on google I found document.location.href could do the trick, but I cannot get it to work.

code:
<script languaje="javascript">
function notepad() {
document.location.href="c:/windows/system32/notepad.exe";
}
</script>

<a href="javascript:notepad();">Test</a>


Anything will be greatly appreciated.

Thanks.
03-25-2007 05:32 AM
Profile E-Mail PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: Run programs with javascript
... not possible, and it should never be possible, things like that are annoying
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-25-2007 05:53 AM
Profile PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Run programs with javascript
It is possible but only with an ActiveXObject.  This means that you will have to accept the ActiveXObject for it to work.

code:
<script languaje="javascript">
function notepad() {
new ActiveXObject("WScript.Shell").Run("notepad");
}
</script>

<a href="javascript://" onclick="notepad()">Test</a>
This works in IE but not FF.  Furthermore you can use any run command as well ;)

This post was edited on 03-25-2007 at 06:04 AM by markee.
[Image: markee.png]
03-25-2007 06:03 AM
Profile PM Find Quote Report
the DtTvB
Junior Member
**


Posts: 47
Reputation: 10
– / Male / –
Joined: Mar 2007
Status: Away
RE: Run programs with javascript
Use markee's way.

But I have an alternative that doesn't even use JavaScript.
Also, this only applies for IE with HTML Editor set to notepad.

(Yeah, this works for notepad only!)

Create a blank file, say, blank.html
And make a link to view-source:http://host.com/blank.html

On IE, a notepad window should popup.

Demo: http://dttvb.yi.org/notepad
the DtTvB - My name has no meaning, but it's unique at least!
[Image: asj.gif]
03-26-2007 03:16 AM
Profile E-Mail PM Web Find Quote Report
YottabyteWizard
Senior Member
****

Avatar

Posts: 709
Reputation: 23
37 / Male / Flag
Joined: Mar 2005
O.P. RE: Run programs with javascript
quote:
Originally posted by markee
It is possible but only with an ActiveXObject.  This means that you will have to accept the ActiveXObject for it to work.

code:
<script languaje="javascript">
function notepad() {
new ActiveXObject("WScript.Shell").Run("notepad");
}
</script>

<a href="javascript://" onclick="notepad()">Test</a>
This works in IE but not FF.  Furthermore you can use any run command as well ;)
Allright! Just what I needed! Thanks!

quote:
Originally posted by the DtTvB
I have an alternative that doesn't even use JavaScript.
Also, this only applies for IE with HTML Editor set to notepad.
Notepad is just one of the programs I'm trying to launch, but thanks anyways :)
03-27-2007 07:35 AM
Profile E-Mail PM Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: RE: Run programs with javascript
quote:
Originally posted by markee
It is possible but only with an ActiveXObject.  This means that you will have to accept the ActiveXObject for it to work.

code:
<script languaje="javascript">
function notepad() {
new ActiveXObject("WScript.Shell").Run("notepad");
}
</script>

<a href="javascript://" onclick="notepad()">Test</a>
This works in IE but not FF.  Furthermore you can use any run command as well ;)


you can try:
<a href="javascript:notepad();" >Test</a>

:)
03-27-2007 10:50 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On