www.webdeveloper.com
Results 1 to 5 of 5

Thread: Run program from JScript

  1. #1
    Join Date
    Nov 2009
    Posts
    3

    Question Run program from JScript

    Hi all,

    I would like to open any program on a computer, using JScript.
    I have this little piece of code here...

    Code:
    function run(url) {
    var File = url;
    var WSH = new ActiveXObject("WScript.Shell");
    WSH.run(File, 1, true);
    }
    Example:

    HTML Code:
    <a href="#" name="cmd.exe" title="Cmd" onClick="run(this.name); return false;">open cmd</a>
    Opening a file like this works perfect.

    Now another example...

    HTML Code:
    <a href="#" name="C:\Program Files\Internet Explorer\iexplore.exe" title="Internet Explorer" onClick="run(this.name); return false;">Internet Explorer</a>

    This DOESN'T work... I think it's because of the spaces in the url... What should i do to make this work?

    Ruben

  2. #2
    Join Date
    Nov 2009
    Posts
    3

    Problem solved, now another one...

    Problem solved... I used the MS-DOS 8-character name for the maps... Now it works great in Internet Explorer (8), but it doesn't work in Chrome or Firefox... Anyone knows how to get it to work?

    Thx,
    Ruben

  3. #3
    Join Date
    Jan 2009
    Posts
    3,346
    ActiveX Objects are IE only. You can try using plugins that the user would have to install for other browsers, or better yet there must be a better solution for the problem at hand. What is the problem this solution is trying to fix?

  4. #4
    Join Date
    Nov 2009
    Posts
    3
    I know that ActiveXObjects are for IE only... But what could i use instead?

  5. #5
    Join Date
    Jan 2009
    Posts
    3,346
    I already told you. You would have to create plugins for each browser you wanted to use them in. Again, there is probably a better way to solve the problem at hand. What is this solution trying to fix?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles