ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

MarkS
Posts: 3
Joined: Thu Nov 19, 2020 3:52 pm

ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

Post by MarkS »

I've been running a suite of VBScripts with Photoshop CS5.1 for years but recently replaced my motherboard and I'm having a problem getting my scripts going again after rebuilding the machine.

To isolate the problem, I've been trying the following test script taken from the Photoshop CS5.1 scripting guide:

1> Dim appRef, docRef, jpgSaveOptions
2>
3> Set appRef = CreateObject("Photoshop.Application")
4> Set docRef = appRef.Documents.Add()
5>
6> Set jpgSaveOptions = CreateObject("Photoshop.JPEGSaveOptions")
7>
8> jpgSaveOptions.EmbedColorProfile = True
9> jpgSaveOptions.FormatOptions = 1 'for psStandardBaseline
10> jpgSaveOptions.Matte = 1 'for psNoMatte
11> jpgSaveOptions.Quality = 1

As it's 32bit I run it using c:\SysWoW64\cscript.exe

After the clean install of Windows 10 this wouldn't work (as expected) with an ActiveX Can't create object error, so I started the ActiveX Installer (AxInstSV) service and set its startup type to automatic and rebooted the machine.

The test script now runs, opens Photoshop OK and opens a new document but then fails when it gets to JPEG save options with:

test.vbs(6, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

So it can create the Photoshop.Application object but not the Photoshop.JPEGSaveOptions object. Any ideas why that might be?!

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

User avatar
Kukurykus
Posts: 531
Joined: Mon Jul 25, 2016 12:36 pm

Re: ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

Post by Kukurykus »

Maybe update Windows and your motherboard, or better use more common JavaScript.
MarkS
Posts: 3
Joined: Thu Nov 19, 2020 3:52 pm

Re: ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

Post by MarkS »

Thanks for the reply, but it's a brand new motherboard and a clean install of Windows 10 which is up to date. The scripts run Photoshop jobs and also access the filesystem and an Oracle database via ODBC so VBScript is the only option.
MarkS
Posts: 3
Joined: Thu Nov 19, 2020 3:52 pm

Re: ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

Post by MarkS »

I've made some progress. In the registry, there's only an entry for the class Photoshop.JPEGSaveOptions.55 rather than Photoshop.JPEGSaveOptions and if I change the script above to

6> Set jpgSaveOptions = CreateObject("Photoshop.JPEGSaveOptions.55")

then it works. I can only assume that because I originally ran the scripts on Photoshop CS2 that there were some legacy entries in the registry in my old system build but on the new system it's only ever been run on a new install of Photoshop CS Design Standard 5.5.

So the question now is - should I update all of my scripts or try to update the registry?

Even though it's more work I'm guessing updating the scripts will be the safer option ;-)
Attachments
2020-11-24.png
2020-11-24.png (16.27 KiB) Viewed 10751 times
alexandersmith
Posts: 1
Joined: Tue Oct 22, 2024 10:26 am

Re: ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

Post by alexandersmith »

MarkS wrote: Thu Nov 19, 2020 4:05 pm I've been running a suite of VBScripts with Photoshop CS5.1 for years but recently replaced my motherboard and I'm having a problem getting my scripts going again after rebuilding the machine.

To isolate the problem, I've been trying the following test script taken from the Photoshop CS5.1 scripting guide:

1> Dim appRef, docRef, jpgSaveOptions
2>
3> Set appRef = CreateObject("Photoshop.Application")
4> Set docRef = appRef.Documents.Add()
5>
6> Set jpgSaveOptions = CreateObject("Photoshop.JPEGSaveOptions")
7>
8> jpgSaveOptions.EmbedColorProfile = True = free iq test with instant results
9> jpgSaveOptions.FormatOptions = 1 'for psStandardBaseline
10> jpgSaveOptions.Matte = 1 'for psNoMatte
11> jpgSaveOptions.Quality = 1

As it's 32bit I run it using c:\SysWoW64\cscript.exe

After the clean install of Windows 10 this wouldn't work (as expected) with an ActiveX Can't create object error, so I started the ActiveX Installer (AxInstSV) service and set its startup type to automatic and rebooted the machine.

The test script now runs, opens Photoshop OK and opens a new document but then fails when it gets to JPEG save options with:

test.vbs(6, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'Photoshop.JPEGSaveOptions'

So it can create the Photoshop.Application object but not the Photoshop.JPEGSaveOptions object. Any ideas why that might be?!
It seems like the JPEGSaveOptions ActiveX component isn't registering correctly. Try reinstalling Photoshop, running the script as an admin, or checking for registry issues. Ensure you're using the correct version of cscript for your Photoshop installation.