Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute

Status
Not open for further replies.

SpiderBear6

Programmer
Sep 17, 2003
422
AU
Hi all,

I am trying to launch an iesetup from a html page but I need to be able to close the ie window before the install gets started.

This is what I have so far...

<html>

<BODY>

<SCRIPT Language=&quot;JavaScript&quot;>
function LaunchIESetup()
{

var oShell = new ActiveXObject(&quot;Shell.Application&quot;);

var commandtoRun = &quot;ie6setup.exe&quot;;
var commandParms;
oShell.ShellExecute(commandtoRun, commandParms, &quot;&quot;, &quot;open&quot;, &quot;1&quot;);

window.opener=self;
window.close();
}
</SCRIPT>

<form>
<input type=button value=&quot;Close Window&quot; onClick=&quot;LaunchIESetup();&quot;>
</form>

</body>
</html>

My problem is I need to be able to give the ShellExecute a relative path to the ie6setup.exe. BTW: this htm file will be on a CD not a web site.

Any ideas?
 
ThunderBear6,

Have a look at this example I wrote for you:

Code:
<HTML>
<HEAD>
  <TITLE>Run FTP</TITLE>
  <SCRIPT LANGUAGE=&quot;JavaScript&quot;>
    function runApp() {
      try{
        shell = new ActiveXObject(&quot;WScript.Shell&quot;);
        path = shell.run(&quot;c:\\windows/system32/ftp.exe&quot;);
      } 
      catch(error) {
        alert(&quot;Something did not work...\n\n&quot;+error.description)
      }
    }
  </SCRIPT>
</HEAD>
<BODY>
<H1>FTP Client Launcher</H1>
  <A HREF=&quot;javascript:runApp()&quot;>Launch FTP Client now!</A>
</BODY>
</HTML>

Some restrictions, though:

You must enable ActiveX Initialize and Script ActiveX Controls not marked as Safe to make it work!

Good luck §;O)


Jakob
 
I actually needed the shell command to use a relative path but I think I have figured out how to get the path and give it to the shell command.

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top