Skip to main content
Participant
July 5, 2024
Question

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

  • July 5, 2024
  • 1 reply
  • 416 views

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 has been closed for replies.

1 reply

Legend
July 5, 2024

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/

Participant
July 8, 2024

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?