Current location - Health Preservation Learning Network - Healthy weight loss - Error in using ActiveXObject in ps script, prompt "ActiveXObject has no constructor"?
Error in using ActiveXObject in ps script, prompt "ActiveXObject has no constructor"?
When using ActiveXObject in PS script, you may encounter the error "ActiveXObject has no constructor". This is because ActiveXObject is an object in JavaScript, and the scripting language of Photoshop is not pure JavaScript, so the object may not be created correctly.

The solution to this problem is to create ActiveXObject by using the specific syntax of ExtendScript. For example, if you want to use the FileSystemObject, you can use the following code:

JavaScript copy codevar FSO = new ActiveX object(" Scripting。 file system object ");

Similarly, if you want to use another COM object, you can use similar code to create it according to its name.

Please note that using ActiveXObject requires that the corresponding COM object has been installed on the operating system, otherwise it will not work properly.