• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2770
  • Last Modified:

WSH = new ActiveXObject("WScript.Shell") - OBJECT ERROR

I have a simple script.. but when run it I get OBJECT ERROR on
   WSH = new ActiveXObject("WScript.Shell");

ACTIVEX is enabled for everything in the browser!
Still get the error
Any ideas?
  • 3
1 Solution
RobOwner (Aidellio)Commented:
What browser are you running?  could only work in IE and there would be security issues so that you wouldn't be able to access the shell
RobOwner (Aidellio)Commented:
Did that fix the error?
JElsterAuthor Commented:
Only running IE.
Works on some... I turned off all the ActiveX security to test.. same issue
RobOwner (Aidellio)Commented:
This is a security breach.  IE doesn't let you have access to the shell.
Christopher KileCommented:
If you check your Security settings in Tools/Options in Internet Explorer, you'll see a setting for "Initialize and script ActiveX controls not marked safe for scripting".  In order for your code to work, you have to set up Custom security then go find this setting and either set it to Enable (which will let it happen all the time) or to Prompt (where you will be asked when the code is invoked if it's OK to run it) - by default, this is set to Disable in most security configurations.

Leaving this setting as Enable will leave you open to the ugliest and cheapest hack techniques if you use the same browser to navigate the Internet.  I wouldn't recommend telling your users that you want them to do this so your code will work.

BTW, while this won't work in an HTML page, it will work in an HTA:  How Can I Start an Application From an HTA?

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now