Setting position on live shape layer

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

MikeL
Posts: 2
Joined: Mon Jul 13, 2020 2:05 pm

Setting position on live shape layer

Post by MikeL »

Hi all,

I'm new to Photoshop scripting and are still trying to wrap my head around some stuff.
I've created an extension for illustrator which was pretty straight forward and are now working on bringing it over to Photoshop.

I'm struggling with what was fairly simple to do in illustrator that turns out to be somewhat over complicated to do in Photoshop (probably just me that needs to learn it better).

For now I'm struggling with putting an absolute position on a live shape within a canvas/document. Is there a simple way to do this? I've started using script listener to figure out some stuff but the code that it generates isn't the most reader friendly. I could probably do the same with setting the position of shape layer but I really want to understand the code I use.

So lets say for example I have my canvas size at 500 x 500 pixels... and my shape is 10 x 10 pixels big. How would I put that shape at lets say 30x 100y position?

I might add that this was easy to do with an artLayer just by doing

Code: Select all

myArtLayer.position = [x, y];
This on a selected live shape layer seems to work differently? any one knows how this works that could point me in to the right direction would be highly appreciated.

Thanks,
Mike

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

User avatar
Kukurykus
Posts: 531
Joined: Mon Jul 25, 2016 12:36 pm

Re: Setting position on live shape layer

Post by Kukurykus »

Code: Select all

b = (lyr = (aD = activeDocument).activeLayer).bounds, lyr.translate(-b[0] + 10 , -b[1] + 10)
MikeL
Posts: 2
Joined: Mon Jul 13, 2020 2:05 pm

Re: Setting position on live shape layer

Post by MikeL »

Thanks Kukurykus! Appreciate the reply!