View Full Version : launching a VBS script

01-26-2009, 05:49 PM
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.


<script type="text/javascript">

function vbsComplete() {
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;

<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' />

<script type="text/javascript">

document.getElementById('btnInstall').disabled = false;


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


01-26-2009, 06:55 PM
what browser are you using?
If I remember correctly, vbs only works in IE.

01-26-2009, 09:22 PM
Hi Angst

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

rnd me
01-27-2009, 07:48 AM
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.

01-27-2009, 09:13 AM
Hi rnd me

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


rnd me
01-27-2009, 10:17 AM
Hi rnd me

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


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 (http://snipplr.com/view/1937/array-of-mime-types/)

mime types in asp (http://www.onlineworkshop.net/misc/MIME_Types_in_IIS.htm)

virtual files (http://www.codingforums.com/showthread.php?t=116949)