Javascript to delete clipping mask
Hi all,
I have an Applescript that places a PDF into a document. When the file is placed, it's cropbox becomes a clipping mask, which I then need to delete.
So I have the following:
set themasterlayername to "Legend"
tell application "Adobe Illustrator"
tell current document
set clipList to every path item whose clipping is true
repeat with clipItem in clipList
set sel to name of (layer of clipItem)
if sel is themasterlayername then
delete clipItem
end if
end repeat
end tell
end tell
This seems to be the only way I can find path items that are clipping, by testing in a repeat loop whether they belong to the layer I have placed the PDF into.
However, when there are a lot of objects (say from a CAD file) on other layers, the script runs very slowly, as it has to test every object to see if 'clipping' is true
Would this be quicker in Javascript? Delete all clipping path items on a certain layer. Or is there another way to narrow down getting only items belonging to the specific layer? For some reason if I put in 'of layer themasterlayername', I get no objects.
Thanks for any help
Ian