Copy link to clipboard
Copied
hi all
I need to write what I assume is a very simple script.
I have a document with a number of layers all the same size. I need to space them apart by a set amount. I am fairly proficient at scripting for After effects but having had a look through the Photoshop scripting guide I'm finding it quiet hard to work out how to simply reposition a layer to specified position.
any advice greatly appreciated.
../daniel
Copy link to clipboard
Copied
One way it to make a selection where you want to move the layer to. Then tarket the layer and use align layer to selection twice, once for horizontal position relative to selection and the second for the vertical position.
Copy link to clipboard
Copied
The translate function in extendscript is relative. So what you need to do is find where you want to move your layer to and where your layer currently it. You can get the current position by using app.activeLayer.bounds() This will give you the layer cordinates (x leftside, y top, x rightside, and y bottom). Subtract say the upper left cordinates from where you want the layer to be and plug that into the translate function app.activeLayer.translate(x,y).
Copy link to clipboard
Copied
.translate !!!
i was looking for move, position, transform...
thanks muchly people, all good and working exactly how I want.
Copy link to clipboard
Copied
I answered your post at http://ps-scripts.com/bb/viewtopic.php?f=9&t=4874.
If you need more details let me know.