Help Changing Script for New Photoshop Changes
Hi everyone,
I've been using two scripts for a over a year now. I use them in a batch process of opening template PSD files, changing a pattern while mainting it's scale and then saving a jpg.
It would seem that recently Photoshop has made it so that if you change your pattern in an action, it will automatically activate the attribute 'Snap to Origin' within the patternfill object. This never used to be the case when I ran my script, and it's really making a real mess of my work, giving me hours to do it manually.
I don't mind changing my scripts myself, afterall I do code myself. However, for the life of me I can't find where to get the correct attributes of objects. Adobe's documentation from their scripting seems to be a hot pile of mess on GitHub, and trying to find the names of attributes and how to set them is rather frustrating.
I've currently got my layer in a var lr, and I've got a metadata object as meta, then I'm doing this:
if (lr.hasProperty('adjustment') {
var adj = lr.convertToObject(lr.getProperty(p = 'adjustment'), p)
for (o in adj) {
if (adj[o]._obj == 'patternLayer') {
var scale = adj[o].scale ? adj[o].scale._value: 100;
meta.set(activeDocument.activeLayer, 'fill', scale)
break;
}
}
}
I can't find anything online about the patternLayer object, and if I can get the x, y coordinates of where the pattern is originally at before it gets snapped to the origin of the layer it is on. I need these coords so after I've filled the layer with the new pattern, I can set the x and y points back to the exact same place as they were.
You can view the scripts I'm using at: https://github.com/dbalfour/RDM/tree/Photoshop-Scripts/Photoshop%20Scripts. I did not write these scripts, but I don't have the name of the person who had, or I'd reference them in the code. Metadata.jsx' is the script that gathers all the relevant information from the layer before any changes and stores it's attributes. And 'pattern.jsx' sets all of those attributes onto the layer after the pattern fill has been changed.
I look forward to getting some help on my problem and saving my wife and I hours of work.
Thank you!