Closed Yellow-Pelicon closed 4 years ago
This never used to be an issue on my machine until tonight - I think I've nailed down the cause of this though (finally, it's been reported for MONTHS but I've never been able to reproduce it):
function verticallyFixText(textLayer) {
// Make a selection of the text layer that's above the P/T box, then ctrl-j
// the selection from the card text layer
// Make selection from the reference layer
var textAndIcons = app.activeDocument.layers.getByName("Text and Icons");
var ptAdjustmentReference = textAndIcons.layers.getByName("PT Adjustment Reference");
var left = ptAdjustmentReference.bounds[0].as("px");
var top = ptAdjustmentReference.bounds[1].as("px");
var right = ptAdjustmentReference.bounds[2].as("px");
var bottom = ptAdjustmentReference.bounds[3].as("px");
app.activeDocument.selection.select([
[left, top],
[right, top],
[right, bottom],
[left, bottom]
]);
// Only proceed here if the text layer potentially needs to be shifted up
// (If the text isn't long enough, the code will error when attempting to ctrl J)
if (getRealTextLayerDimensions(textLayer).width + textLayer.bounds[0] < left) return;
// get PT Top Reference layer
var ptTopReference = textAndIcons.layers.getByName("PT Top Reference");
Specifying that left
, right
, top
and bottom
should be in pixels seems to do the trick. Let me know if this works on your end pls <3
The fix seems to be working great! Thank you!
Perfect! Closing this thread :)
Script seems to run for the most part, but crashes before the file renaming. Only way I have found around this is to manually rename the files, but I was hoping that it might be able to be automated as well.
I have looked into cryzies issue as well, but it appears that the code is very different in the new version.