Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wscript.shell works in javascript but not vbscript

My particular issue involves the WScript object with VBScript in a HTA.

<script language="VBScript">
    Sub test()
       Set objShell = CreateObject("WScript.Shell") 
    End Sub
</script>

This works perfectly on my work computer(Windows 7 Enterprise) but not on my computer at home(Windows 8 home) and not on my mothers computer(Windows 7 home).

BUT WAIT! THERE'S MORE!

At first I thought maybe the libraries were not there so but I checked another program I wrote that uses JavaScript and it has no problem. Tested the javascript in my app and it runs fine.

<script language="JavaScript">
    function javaTest()
    {
        objShell = new ActiveXObject("WScript.Shell");
    }
</script>

This is the error I keep getting.

ERROR: Provider cannot be found. It may not be properly installed.

I keep coming across solutions about 64 vs. 32 bit and I try them and it doesn't work. It also doesn't explain why it works in JavaScript and not VBScript. I'm frustrated, searched high and low, and I really want a McDouble right about now. So, any info would be greatly appreciated, even if you have to tell me "It's hopeless. Rewrite the whole thing in JavaScript"

like image 810
James Pujol Avatar asked Nov 03 '22 00:11

James Pujol


1 Answers

You probably have different settings on launching ActiveX objects in browsers on this computers. To make it launch try to configure it in browsers:

  • Open on Tools
  • Select Internet Options...
  • Select Security tab.
  • Select Internet in Web content zone. (or zone in which your web page is)
  • Then, click on Custom Level...
  • Find ActiveX section on list (it is really long)
  • In ActiveX settings select Prompt or Enable
like image 122
Piotr Stapp Avatar answered Nov 12 '22 21:11

Piotr Stapp