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
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry How can launch a clientside application in javascript

    I have a web based application that displays an htm page to the client. Is it possible to have say a button for the user to press to run a local application and keep the htm open?

    Also is it possible to display the printers that are available to that user by pressing a button and inserting on the current htm?

    Thanks for help.

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no with javascript; maybe with ActiveX...
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This doesn't fit your situation but you might find it of use.

    As Borgtex suggested this is activeX (IE only). Notice that the paths are DOS paths. You can get those in Windows by looking at the properties of the file.

    For local use, you won't get the activeX warning if you save the page as an .hta file (real simple) rather than .html

    Code:
    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    
    fso = new ActiveXObject("Scripting.FileSystemObject");
    
    function RunProgram(Program_Path) {
    Default_Value = Program_Path.match(new RegExp("Default", "i"))
    if (Default_Value) {
    } else {
    new ActiveXObject("WScript.Shell").Run(Program_Path,3,false)
    }
    }
    
    </script>
    </head>
    <body>
    
    <select onchange="RunProgram(this.value)">
    <option value="Default" selected>Launch Program</option>
    <option value="C:\\PROGRA~1\\MICROS~1\\MICROS~4.LNK">Word</option>
    <option value="C:\\WINDOWS\\EXPLORER.EXE">Explorer</option>
    <option value="C:\\PROGRA~1\\MOZILLA.ORG\\MOZILLA\\MOZILLA.EXE">Mozilla 1.0</option>
    </select>
    
    </body>
    </html>

  • #4
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know anything about WScript, but when I run the htm I get the message:
    'The system cannot find the file specified'.
    Any help appreciated.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If your using windows browse to, right click and select "properties" on each folder in the path to your .exe

    In the window that pops up you'll see the following

    MS-DOS name: some~DOSname .

    Enter the DOS name of each folder in the path and finally the exec file between the double back slashes in the <option> value

    <edit>

    more info on this here

    Linking to a program so it opens instead of prompts to be saved

    </edit>
    Last edited by Graeme Hackston; 04-15-2003 at 11:36 PM.


  •  

    Posting Permissions

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