Shoutbox

Run programs with javascript - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Run programs with javascript (/showthread.php?tid=72998)

Run programs with javascript by YottabyteWizard on 03-25-2007 at 05:32 AM

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.
RE: Run programs with javascript by -dt- on 03-25-2007 at 05:53 AM

... not possible, and it should never be possible, things like that are annoying


RE: Run programs with javascript by markee on 03-25-2007 at 06:03 AM

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 ;)
RE: Run programs with javascript by the DtTvB on 03-26-2007 at 03:16 AM

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


RE: Run programs with javascript by YottabyteWizard on 03-27-2007 at 07:35 AM

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 :)
RE: RE: Run programs with javascript by felipEx on 03-27-2007 at 10:50 PM

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>

:)