Copy link to clipboard
Copied
Hi! I could really use someone's help in writing an AppleScript to remove all graphic lines in an InDesign document that are white and 1 pt. I'm working on a document that has random white lines in it. Any help you can give me is greatly appreciated!!
Thanks,
Jim
Will ExtendScript (.jsx) work?
var lines = app.activeDocument.graphicLines;
var numLines = lines.length - 1;
for (var i = numLines; i >= 0; i--) {
if (lines[i].strokeColor.name == "Paper" && lines[i].strokeWeight == 1) {
lines[i].remove();
}
}
Copy link to clipboard
Copied
Will ExtendScript (.jsx) work?
var lines = app.activeDocument.graphicLines;
var numLines = lines.length - 1;
for (var i = numLines; i >= 0; i--) {
if (lines[i].strokeColor.name == "Paper" && lines[i].strokeWeight == 1) {
lines[i].remove();
}
}
Copy link to clipboard
Copied
Thanks for replying, Brian. I'm not familiar at all with ExtendScript, so forgive me if this is a noob question! I just need to save the above as a .jsx file in a text editor and dump it in my "Scripts" folder in InDesign, correct? Then run from within the program?
When I do that nothing happens. The white lines remain in the document.
Copy link to clipboard
Copied
Follow the instructions from above. You'll want to save the code as plain text with the file extension .jsx, and save it into your User Scripts folder. It will only work on the primary open document.
The key is making sure you saved it as plain text. If you're using Text Edit, you'll want to use the Make Plain Test option; text edit will save as a rich text format by deault.
Edit: So are you saying there's no error message, just nothing happens? What swatch color are the white lines, an actual color called White or the default Paper swatch? I used Paper in the script, but you can change the if statement to look at a different name if the name is different. And are you sure all the lines have a stroke weight of 1 pt? That's what the script is looking for.
And, are they all GraphicLines, or is it the frames on Graphics that you're trying to change? Two distinct things from a scripting perspective.
Copy link to clipboard
Copied
Thanks, Brian. The script does work! I opened a new doc in InDesign and put in one rule at 1 pt and colored it white. POOF - Deleted. Now I just need to figure out why it doesn't work in my original document. Thanks, again!!
UPDATE: You called it, Brian! I thought that the color was "Paper", but it was "White" in the swatch panel. I changed that in the script and it works great! Thanks for your patience and help! Much appreciated!