An error occurred when calling Wscript.Shell when the Automation server could not create an object

Source: Internet
Author: User

We often need to generate ActiveXObject ("Wscript.Shell") to tune an EXE file,

Such as

Set page header footer to print is empty

var Hkey_root,hkey_path,hkey_key;
Hkey_root= "HKEY_CURRENT_USER";
Hkey_path= "//software//microsoft//internet explorer\\pagesetup\\";
function Pagesetup_null ()
{
try {
var wsh=new activexobject ("Wscript.Shell");
hkey_key= "Header";
Wsh.regwrite (Hkey_root+hkey_path+hkey_key, "");
hkey_key= "Footer";
Wsh.regwrite (Hkey_root+hkey_path+hkey_key, "");
} catch (E)
{
Alert ("Error:" +e.message+ "). ");
}
}

Call Calculator
{
var WshShell = new ActiveXObject ("Wscript.Shell");
Wshshell.run ("Calc.exe");
}

However, the "Automation server cannot create objects" error is often reported
The following is the solution

1, if it is Scripting.FileSystemObject (FSO text file read and write) is closed,
Turn on the FSO function and execute regsvr32 scrrun.dll in "Run"

2, the security mode is set to "medium", if the JavaScript script reported this error,
You should also enable the security settings for IE to not allow ActiveX controls that are not marked as safe to run.

Note If you set the appropriate site to "Trusted Sites",
You must have the appropriate IE security settings for Trusted sites, which will be futile if you set up Internet ie.

3. Some scripts require Microsoft's MSXML control to enter.
When using the default security mode of IE 5 or later, you are prompted to accept the MSXML control.
If accepted, MSXML will be automatically installed on your machine (it has to wait a few minutes).
If the automatic installation is unsuccessful, you can download and install the MSXML 3.0 SP7 yourself.
Sometimes it is because the MSXML 3 service is turned off, use regsvr32 msxml3.dll to

An error occurred when calling Wscript.Shell when the Automation server could not create an object

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.