Hi,
It’s the same without the ViewConfig in the file, this is created AFTER the process is run. Delete it and try again!
My Script code does the same as yours and it’s picking up the right layers. When processing Art Layers, it ignores anything that begins with a “-“ and also my loop is confined to the art layers into -pShapeX groups.
I’ve run this file with a simple X,Y dumper I got from the web and it shows negative offsets (without any extra groups or layers being added to the PSD, just the 4 shapes).
All the Best Dave
On 5 Sep 2014, at 10:47, Shane Stanley < email@hidden> wrote: On 5 Sep 2014, at 6:55 pm, Dave < email@hidden> wrote: Well, you got lucky or you version of PS is different. I’m seeing -1’s, -2’s etc and one case where everything seemed to be based around 31!
No, I get the same with CS6.
(Dave sent me the document off-list.)
The problem is that you failed to mention that there are several other layers in that document, and it looks like you're getting the bounds of the wrong ones (the ones in the ViewConfig layer set).
If I change my code to allow for the fact that you have all layers enclosed in layer sets:
tell application id "com.adobe.Photoshop" set theBounds to bounds of art layers of layers of document 1 set x to art layers of layers of document 1 end tell log theBounds repeat with i from 1 to count of theBounds set item i of theBounds to my cocoafy(get item i of theBounds) end repeat return theBounds
on cocoafy({x1, y1, x2, y2}) return {x1, y1, x2 - x1, y2 - y1} end cocoafy
I get:
{{0.0, 0.0, 20.0, 20.0}, {20.0, 0.0, 20.0, 20.0}, {0.0, 20.0, 20.0, 20.0}, {20.0, 20.0, 20.0, 20.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 365.0, 118.0}, {0.0, 0.0, 40.0, 40.0}}
The first four are the squares; the rest are other art layers in your document.
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
|