myDoc = app.activeDocument;
myLayer = myDoc.layers.item("AD");
myLayer.locked = false;
for (k=0; k<myDoc.allPageItems.length; k++)
if (myDoc.allPageItems[k].itemLayer == myLayer)
currPItem = myDoc.allPageItems[k];
currPItem.fit(FitOptions.PROPORTIONALLY); // or another option you choose
myLayer.locked = true;
Wow, so simple! I wish I would have thought of that. This is great, and I hope it's something everyone can use.
A very good -- although short -- thread. Very very useful.
What are the other options beyond PROPORTIONALLY? Is there a list I can look at to choose the correct code?
If you use the ESTK, look in the Help menu; it should have a "Browse Object Model" item.
... If you still can't find it after some frantically clicking :-) check out http://jongware.mit.edu/idcs6js/pe_FitOptions.html. It's the same information, but in a friendlier format.
Although my version has an index as well, you might find stuff even easier to find if you download the CHM version from my site and open it with a suitable Help viewer. Searching is then just a question of typing just about annyfing in the provided "search" field ... (http://www.jongware.com/idjshelp.html) On Windows you can use the standard Help file viewer, for Mac OS X you have to find something suitable. A link to a fine one is on my web page.
Jongware! Very very nice.