I need assistance with developing a function that can load an image and position it at specific x, y coordinates in Photoshop.
Below is the code I have so far:
var docRef = app.activeDocument;
function MoveLayerTo(fLayer, fX, fY) {
var Position = fLayer.bounds;
Position[0] = fX - Position[0];
Position[1] = fY - Position[1];
fLayer.translate(-Position[0], -Position[1]);
}
var doc = app.documents.add();
MoveLayerTo(doc, 12, 24)
}
However, when attempting to execute the code, I encounter the following error message:
Error 21: undefined is not an object.
I am seeking advice on debugging this issue and resolving it to make my code functional. Any suggestions?