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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    launching a VBS script

    Hi newbie question,
    I am trying to get a VBS to launch from a button click. I have had some help from a colleague but so far no luck, so far all that happens when the button is clicked is it switches from being highlighted "click me..." to a depressed "installing" my Vbs path is correct,
    I would be really grateful for any help.

    </head>
    <body>

    <script type="text/javascript">

    function vbsComplete() {
    //alert('Completed!')
    }
    function install() {

    var vbs = 'http://servername/*****/vbs/*.vbs';
    var applet = '<APPLET CODE="org.*****.ProcessStarterApplet" ARCHIVE="ProcessStarter2.jar" WIDTH="0" HEIGHT="0" MAYSCRIPT>';
    applet += '<PARAM NAME="scriptUrl" VALUE="'+vbs+'" /><PARAM NAME="cache_archive" VALUE="ProcessStarter2.jar,plugin.jar">';
    applet += '<PARAM NAME="showConfirm" VALUE="false" /></APPLET>';

    document.getElementById('appletDiv').innerHTML = applet;
    document.getElementById('btnInstall').value = 'Installing';
    document.getElementById('btnInstall').disabled = true;
    }
    </script>

    <form>
    <div>
    <p align="justify"><img src="http://******/888888/*.png" width="148" height="51"></p>
    <p align="justify">Welcome to the blah blah blah </p>
    <p align="justify"><img src="http://*****/888888/*.jpg" width="126" height="124"></p>
    <p align="justify"></p>
    <p align="justify">
    <input type='button' id='btnInstall' onclick='install();' value='Click me to begin install' />
    </p>
    </div>

    <script type="text/javascript">

    document.getElementById('btnInstall').disabled = false;
    </script>

    </form>

    <div id='appletDiv'></div>

    </body>
    </html>

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    what browser are you using?
    If I remember correctly, vbs only works in IE.

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Angst

    Thanks for the reply, it should work in IE and Mozilla, because its called through the Applet. currently its working in neither,
    Cheers

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,366
    Thanks
    11
    Thanked 590 Times in 571 Posts
    simply opening a new window to a vbs file/url will ask the user if the script should be executed on windows machines.

    if you need to run it without the user being there, you will have to have the user regeister the vbs file with a unique mime type that you create. you can then point to a trigger file with that mime type, and it will run the vbs...

    like when you associate "audio/mp3" with itunes or whatever, when clicking on mp3 links.

    outside of IE7 and under, you can create a virtual document of that mimetype on the client, eliminating the need for any server configs.
    Last edited by rnd me; 01-27-2009 at 06:54 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #5
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi rnd me

    Could you say that again in terms that an idiot will understand please.

    Thanks

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,366
    Thanks
    11
    Thanked 590 Times in 571 Posts
    Quote Originally Posted by Darkcain View Post
    Hi rnd me

    Could you say that again in terms that an idiot will understand please.

    Thanks
    No.
    probably not for idiots...

    but here a better written explanation:



    applications can be associated with a type of document.

    these applications will open to handle documents whose locations are opened by the browser.

    by choosing the xxx.vbs on the local machine the first time a new file type is encountered, xxx.vbs will execute each time that type is opened (whether it actually does anything with the document or not)

    once you have a unique type picked out, set a file's type, or a server's response mimeType (check server docs for info), and the familiar "Open or Save" box will pop-up when that special page is opened.

    browsers other than IE7 and before can open a 'virtual' document that's not really anywhere. The virtual document feature allows you to specify the type of file. The content of this file does not matter. what matters is that you open it, and in turn the helper 'application' (your vbs script) executes to handle the document.

    for IE6+7, you must have a custom type set on a file upon a server, and then open the actual document from it's url. You can change the document type in the file manager (sometimes), or on a simple server script (always).



    check out these for more info:

    big list of mime types youv'e probably heard of

    mime types in asp

    virtual files
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%


  •  

    Posting Permissions

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