Skip to main content
Participant
Jul 5, 2024 9:53 AM UTC
Question

How to use C++ to do automation in Photoshop on Windows?

I've managed to write javascript or C# to automate some tasks in photoshop. But javascript is slow, C# requires .NET runtime. I managed to get the IDL file of Photoshop which helps me use OLE automation in WIN32 API, but no document is found regarding how to use these interface methods in C++. For example, there is such "ExecuteAction" method in interface "_Application" with signature: 

[id(0x506c6179), helpstring("play an ActionManager event")]
            _ActionDescriptor* ExecuteAction(
                            [in] long EventID, 
                            [in, optional] VARIANT Descriptor, 
                            [in, optional] VARIANT DisplayDialogs);

I don't know how to pass the "VARIANT Descriptor" to it, what type should I set the VARIANT to, a dispatch interface pointer? And the "VARIANT DisplayDialogs", an integer?

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Legend
Jul 5, 2024 1:48 PM UTC

The JavaScript engine used by UXP is much faster than the old Extendscript engine.

Adobe's developer page for PS is here:

https://developer.adobe.com/photoshop/

Translate
Participant
Jul 8, 2024 1:53 AM UTC

Thanks for replying. Can I run a UXP plugin directly from command line like "Photoshop.exe xxx.jsx" or from programming code without having user click the plugin menu?

Translate