lohriialo / photoshop-scripting-python

Scripting in Photoshop is used to automate a wide variety of repetitive task or as complex as an entire new feature
485 stars 95 forks source link

How to create an instance of BatchOptions? #4

Closed zhuquechiye closed 5 years ago

zhuquechiye commented 5 years ago

There is an error: pywintypes.com_error: (-2147221164, 'Class not registered', None, None) when I run this code: from doc_reference.photoshop_CC_2018 import BatchOptions batch_options = BatchOptions()

There is another error: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop', 'Illegal argument - argument 4\n- Internal error', None, 0, -2147220259), None) when I tried that: app = Dispatch("Photoshop.Application") batch_options = BatchOptions(app) app.Batch(InputFiles=img_ref, Action=actions[5], From=action, Options=batch_options)

I need choose some options for the Batch command and I found these options in _prop_mapget and _prop_mapput, but I do not know how to do.

thank you

lohriialo commented 5 years ago

You can try

from comtypes.client import GetActiveObject, CreateObject
batch_options = CreateObject("Photoshop.BatchOptions")
zhuquechiye commented 5 years ago

You can try

from comtypes.client import GetActiveObject, CreateObject
batch_options = CreateObject("Photoshop.BatchOptions")

thank you! This solved my problem.