Question
Swatch to Layer InDCS2...
Hi everyone,<br /><br />We have more than hundreds of InDesign documents. What we have to do is, turned off this "IE-Black" spot color swatch applied paragraphs in the document. So i am finding "IE-Black" spot color applied paragraphs in the documents then apply "ANNO" named layer to the corresponding paragraphs text frames. And finally hiding them all. If i have tested this script in the new document its working fine. But not working in our exiting documents. It showing error like, <br /><br />------<br />Error Number:45<br />Error string:Object is invalid<br />Line:12<br />------<br /><br />Please find my script below;<br /><br />----<br />var myDoc = app.activeDocument;<br />with (myDoc){<br /> myNewLayer = layers.add();<br /> with (myNewLayer) {<br /> name = "ANNO"<br /> }<br />}<br />var mySwatch = myDoc.swatches.item("IE-Black");<br />for (i=0; i<myDoc.textFrames.length; i++){<br /> if (myDoc.textFrames.paragraphs[0].fillColor == mySwatch )<br /> {<br /> myDoc.textFrames.itemLayer=myNewLayer;<br /> }<br />}<br />myNewLayer.visible=false;<br /><br />alert ("DONE...")<br />----<br /><br />Thanks in advance<br />Thiyagu