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