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

basic repositioning script

Contributor ,
Jun 19, 2012 Jun 19, 2012

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

TOPICS
Actions and scripting

Views

810

Translate

Translate

Report

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

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.

JJMack

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

.translate !!!

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

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

Votes

Translate

Translate

Report

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
Guru ,
Jun 19, 2012 Jun 19, 2012

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.

Votes

Translate

Translate

Report

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