Message Board for Rorohiko Workflow Resources
https://www.rorohiko.com/cgi-bin/yabb2/YaBB.pl
General Category >> General Board >> APID - Items on locked layers are not affected
https://www.rorohiko.com/cgi-bin/yabb2/YaBB.pl?num=1213626259

Message started by WellerUK on 06/17/08 at 02:24:19

Title: APID - Items on locked layers are not affected
Post by WellerUK on 06/17/08 at 02:24:19
Hi there

In my test document I have a little square with event filter set to "modified" and the following script attached:

bBox = theItem.geometricBounds;
point = new Array
point[1] = (bBox[0] + bBox[2])/2;
point[0] = (bBox[1] + bBox[3])/2;
myDoc=app.activeDocument;
myDoc.pageItems.item("frame").paths[0].pathPoints[1].anchor = point;

On another layer there is a simple path with "frame" label.
When i move the square the path reshapes. However when I lock the layer with the path and move the square nothing happens. Is there a way to make it work even though the controlled path is on the locked layer?

Thanks
weller

Title: Re: APID - Items on locked layers are not affected
Post by Kris Coppieters on 06/17/08 at 06:44:43
Hi WellerUK,

What about something like (quick and dirty conceptual code - for real life use would need to be cleaned up, 'var' declarations added, etc...):


bBox = theItem.geometricBounds;
point = new Array
point[1] = (bBox[0] + bBox[2])/2;
point[0] = (bBox[1] + bBox[3])/2;
myDoc=app.activeDocument;
myFrame = myDoc.pageItems.item("frame");
frameLayer = myFrame.itemLayer;
layerLocked = frameLayer.locked;
frameLayer.locked = false;
myFrame.paths[0].pathPoints[1].anchor = point;
frameLayer.locked = layerLocked;

Title: Re: APID - Items on locked layers are not affected
Post by weller on 06/17/08 at 08:06:45
Hi Kris

I'm at home right now so I cannot test it but it seems like simple idea that will work in practice. (I'm ashamed I didn't think of it before posting the question)

Thanks a lot
weller






Oh by the way. How is it with APID not affecting items on locked layers? Is it an intention or bug?

Title: Re: APID - Items on locked layers are not affected
Post by Harbs on 06/17/08 at 09:09:12
APID works with objects on locked layers. It's the script which doesn't change anything because the layer is um... locked!

Title: Re: APID - Items on locked layers are not affected
Post by weller on 06/17/08 at 09:20:17
Thanks Harbs

I didn't know about this limitation of ExtendScript. It might save me a lot of frustration in the future, now that I know.
Sorry for framing APID, Kris

weller

Message Board for Rorohiko Workflow Resources » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.