Well, my image is a square of 500 px and the width of the pasted layer is also 500px but only 300px in height. I want it to be positioned on 150 px from the top and thus 50 px from the bottom. I know how to get the dimensions of the documents but I already know them before using the script so that’s not a problem. I tried
set theBounds to bounds of layer "Layer 1"
and it gave me the bounds in centimeters, I’d like to have them in pixels but this gave an error
set theBounds to bounds of layer "Layer 1" as pixels
If this is the case is your pasted layer NOT centered? 500 pixels - 300 pixels = it is already 100 pixels down from top left just translate a further 50 pixels. Or have I overlooked some thing?
As a rule I always set the app settings to pixel units do script stuff then put the settings back.
Hmm, it’s kind of weird, my script uses a layer from another image and duplicates it in a new document like this:
tell the current document
duplicate layer 1 to beginning of document "doc.psd" of application "Adobe Photoshop CS4"
end tell
And if the layer is transparent, it looks like it duplicates it on the top of the other document but if it isn’t, it indeed centers it. The ruler settings thing works great