Skip to main content
Inspiring
June 19, 2012
Question

basic repositioning script

  • June 19, 2012
  • 3 replies
  • 905 views

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

This topic has been closed for replies.

3 replies

Inspiring
June 19, 2012

I answered your post at http://ps-scripts.com/bb/viewtopic.php?f=9&t=4874.

If you need more details let me know.

Chuck Uebele
Community Expert
Community Expert
June 19, 2012

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).

Inspiring
June 20, 2012

.translate !!!

i was looking for move, position, transform...

thanks muchly people, all good and working exactly how I want.

JJMack
Community Expert
Community Expert
June 19, 2012

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.

JJMack