Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2004
    Posts
    194
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Disable File Download/Save/Open Dialog For EXE's

    This is something Iíve been trying to get working but for some reason no matter what I try it just won't have it. Basically Iíve scripted a launcher into the navigation menu Iíve developed for the intranet I'm rebuilding for work, whereby on the navigation bar at the top of the site there is a button you can click and it opens a drag able div which holds an image map containing several links. Each link is coded to run a certain program, each of these being from the Microsoft Office suite, like Word, Excel etc.

    Each of the PCs that will be viewing the site all have the EXACT same programs installedd in the same directory locations, as all of them use the same hard drive image, so I donít have to worry about people not having the programs to execute.

    The problem is once the image map link for each program is clicked and the program is launched from the onClick event, I get the dam Save/Open File Download dialog box appear asking me if I want to save the file or open it. All I want to do is disable that dialog so that the exe file is automatically run without a prompt so it's seamless and each hyperlink on the image map to run the programs works like a desktop shortcut. I need to make this work as for an IT only internal mini site I need to execute bat files for server ping tests in the same kind of way as well.

    So far Iíve tried just about everything I can think of, such as using form buttons and the window.location.href method and it still invoked the dialog. Basically Iím running short of ideas to stop the dam thing, it doesn't need stopping permanently, however that would do if there was no other option than that, I donít need to worry about virus issues or anything as this isn't an internet site, it is intranet only and run from a network server so only those on the network will be able to access the site anyway.

    Thanks in advance.
    Last edited by Acid; 06-22-2004 at 11:43 PM.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You should look into .hta's

    Code:
    <script type="text/JScript">
    var v = new ActiveXObject("Shell.Application");
    function SysFolder(){
    var w;
    w = new ActiveXObject("Shell.Application");
    // Change Number for different folders
    w.Open(32);
    }
    </script>
    </head>
    <body>
    <p>
    <a href="javascript&#58;v.ShellExecute('wmplayer.exe', '', 'C:\\Program Files\\Windows Media Player');">Windows Media Player</a><br>
    in: C:\\Program Files\Windows Media Player\<br>
    (if you have it there)
    </p>
    <a href="javascript&#58;v.ShellExecute('Notepad');">Notepad</a><br>
    in the system folder (if you have it there)
    </p>
    <p>
    <a href="javascript&#58;v.ShellExecute('explorer.exe', '', '%SystemRoot%\explorer.exe');">Windows Explorer</a>
    </p>
    <p>
    <a href="javascript&#58;SysFolder()">Temporary Internet Files</a>
    
    </body>
    </html>
    .....willy

  • #3
    Regular Coder
    Join Date
    Jun 2004
    Posts
    194
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Cheers, that worked fine, only one problem though. That code works, as long as it's used locally on the computers hard drive. The site is going to be hosted on a networy server and for some reason using the identical code with no differences what so ever it just doesn't want to work if it isn't run from the hard drive.

  • #4
    Regular Coder
    Join Date
    Jun 2004
    Posts
    194
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Still not working, tried altering the code to use functions, again it works if it's run from the hard drive but as soon as it's on a network server the dam thing keeps saying there's a file permission error, which is crap because if i use a regular hyperlink directly to the exe it has no problem accessing it, it just opens the file download box. The other code i've tried is this:

    Code:
    <html>
    <head>
    <script language="JavaScript">
      function RunWord() {
        var obShell = new ActiveXObject("Shell.Application");
        obShell.ShellExecute("file:///C:\\Program Files\\Microsoft Office\\Office\\WINWORD.exe", "", "", "open", 1);
        return false;
      }
    </script>
    </head>
    <body>
    <p>
    <a href="#" onClick="RunWord(); return false;">Run Microsoft Word</a>
    </p>
    </body>
    </html>
    Any ideas?

  • #5
    Regular Coder
    Join Date
    Jun 2004
    Posts
    194
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Ahh nevermind i've got it working now, i re-wrote the script a few times over and tried different combinations of things, even resorted to cracking open VB and writing a new ActiveX control DLL, the problem seems to be attributed to the network server itself, as i tested the different codes out on the server that hosts my site (my personal website that is the link of which is in my sig) so it's just a case of adjusting the server configuration at work. Anyway thanks for the help.


  •  

    LinkBacks (?)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •