-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot move a layer image object with actions scripting #256
Comments
The descriptor has no target, so it doesn't know what layer to perform the transform on. idTrnf = ps.app.charIDToTypeID("Trnf")
mainEventsDetails = ps.ActionDescriptor()
# Add a target reference
ref = ps.ActionReference()
ref.putEnumerated(sID("layer"), sID("ordinal"), sID("targetEnum"))
mainEventsDetails.putReference(sID("target"), ref)
idFTcs = ps.app.charIDToTypeID("FTcs")
idQCSt = ps.app.charIDToTypeID("QCSt")
idQcsa = ps.app.charIDToTypeID("Qcsa")
mainEventsDetails.putEnumerated(idFTcs, idQCSt, idQcsa)
offsetDetails = ps.ActionDescriptor()
idHrzn = ps.app.charIDToTypeID("Hrzn")
idPxl = ps.app.charIDToTypeID("#Pxl")
offsetDetails.putUnitDouble(idHrzn, idPxl, 1909.000000)
idVrtc = ps.app.charIDToTypeID("Vrtc")
idPxl = ps.app.charIDToTypeID("#Pxl")
offsetDetails.putUnitDouble(idVrtc, idPxl, 30.000000)
idOfst = ps.app.charIDToTypeID("Ofst")
idOfst2 = ps.app.charIDToTypeID("Ofst")
mainEventsDetails.putObject(idOfst, offsetDetails)
ps.app.executeAction(idTrnf, mainEventsDetails, 1) There is also a simpler way this action could be performed, just get the layer you need to move and translate it with the API. layer = app.activeDocument.artLayers.getByName("Layer Name")
layer.translate(1909, 30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I am currently working on a project where I need to manipulate Photoshop files using Python. Specifically, I'm trying to move a layer image object in a Photoshop document. However, I am running into some trouble with this task and could use some guidance.
Here is a snippet of the code I'm currently using:
When the putObject method is invoked, I'm encountering a COMException error:
line 745, in _invoke
self.__com_Invoke(memid, riid_null, lcid, invkind,
_ctypes.COMError: (-2147220261, None, (None, None, None, 0, None))
(-2147212704, None, (None, None, None, 0, None)).
I believe the issue lies in the putObject method, where I'm attempting to adjust the offsets of the image object. However, I'm not certain about the cause of this issue or how to resolve it.
I'd greatly appreciate any insight or advice on how to properly move a layer image object in Photoshop using actions scripting in Python.
Thank you!
The text was updated successfully, but these errors were encountered: