frame tool bounds always 0

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

Megals
Posts: 10
Joined: Wed Jan 18, 2023 2:52 pm

frame tool bounds always 0

Post by Megals »

Hello,

i want to get the bounds of the frame tool but it is always 0. If there is an image it shows the bounds of the image. Is there a way to get the bounds of the empty frame?

Best regards
Chris
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: frame tool bounds always 0

Post by Kukurykus »

Code: Select all

sTT = stringIDToTypeID;
(ref = new ActionReference())
.putProperty(sTT('property'), sTT('framedGroup'))
ref.putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum'))
cnt = (dsc = executeActionGet(ref).getObjectValue(sTT('framedGroup')).getObjectValue(sTT('framedGroupRect'))).count
tlbr = {}; for(i = 0; i < cnt;) tlbr[sde] = dsc.getDouble(sTT(sde = typeIDToStringID(dsc.getKey(i++)))); alert(tlbr.toSource())
Megals
Posts: 10
Joined: Wed Jan 18, 2023 2:52 pm

Re: frame tool bounds always 0

Post by Megals »

Thank you, it is working!