Monday, August 4, 2014

Open local file(any type of file) using Internet Explorar.

I am going to share a code to open any type of desktop application using Internet Explorar (IE) .



If you run this code inside the browser, it will not work. To resolve this, just save the file with a .hta extension. You will see that the file icon has changed to an application icon. If you double click on this file, it will execute and open a Window having the button inside it. Click the button to open the notepad.exe file.

<html>
<head>
    <title>Application Executer</title>
    <HTA:APPLICATION ID="oMyApp"
   APPLICATIONNAME="Application Executer"
   BORDER="no"
   CAPTION="no"
   SHOWINTASKBAR="yes"
   SINGLEINSTANCE="yes"
   SYSMENU="yes"
   SCROLL="no"
   WINDOWSTATE="normal">
    <script type="text/javascript" language="javascript">
        function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
        }
    </script>
</head>
<body>
<input type="button" value="Run Notepad" onclick="RunFile();"/>
</body>
</html>

No comments:

Post a Comment