View Single Post
  #9   Spotlight this post!  
Unread 15-02-2004, 21:55
Greg's Avatar
Greg Greg is offline
Registered User
FRC #1075 (Sinclair Sprockets)
Team Role: College Student
 
Join Date: Nov 2002
Rookie Year: 2003
Location: Whitby, Ontario, Canada
Posts: 108
Greg is on a distinguished road
Send a message via ICQ to Greg Send a message via MSN to Greg
Re: Launch Applications with HTML?

Here's a way of doing this with IE and javascript:
PHP Code:
<HTML>
<
HEAD>
<
SCRIPT type="text/javascript" LANGUAGE="JavaScript">
  function 
executeCommands()
   {
  
// Instantiate the Shell object and invoke its execute method.
    
var oShell = new ActiveXObject("Shell.Application");
    var 
commandtoRun "C:\\Windows\\Notepad.exe";
 
// Invoke the execute method.  
     
oShell.ShellExecute(commandtoRun""
   
"""open""1");
  }
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<Input type="Button" name="cmdNote" 
   value="Run Notepad" onClick="executeCommands();"  />
</CENTER>
</BODY>
</HTML> 
Once you save this as an HTML file and open it in IE, you can run Notepad by clicking the button. A security warning should pop up. If you want to get rid of it, modify security settings for the Local Intranet zone to allow "opening programs in an IFRAME". Be very careful when doing this. There are known (and unknown yet ) bugs in IE that could allow an internet page to appear as if it is on the intranet. Check what security zone Outlook is in too if you use it (it should be in Internet by default, but check anyway ) Well, you have been warned

You can use this technique to open any file (it does not have to be executable). And there are similar techniques for interacting with Word, Excel, etc. And by the way, I found this script on this page originally: http://www.midrangeserver.com/mpo/mp...2-story01.html