Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

basic repositioning script

Contributor ,
Jun 19, 2012 Jun 19, 2012

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

TOPICS
Actions and scripting
907
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 19, 2012 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2012 Jun 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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 19, 2012 Jun 19, 2012
LATEST

.translate !!!

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 19, 2012 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines