🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #222

Re: remove all Graphic Lines

#222
From: Martin Fischer
Date: Sat, 06 Jun 2009 20:44
43 lines
2580 bytes
Hi Mike,

 > but following script can't work

you have posted some randomly selected lines of a code.
I cannot see the relation between the lines and the job that should be done.

To remove every graphicline of a document you can try something like this:

------ code begin --------
app.activeDocument.graphicLines.everyItem().remove();
-------- code end ----------

To remove every graphicline of a document whose strokeweigth is 4 pt you 
can try something like this:

------ code begin --------
// adress every graphicline of the active document
var allGraphicLines = app.activeDocument.graphicLines;
// check the strokeweight of every graphicline
for ( var i = allGraphicLines.length-1; i >= 0; i-- )
	if (allGraphicLines.item(i).strokeWeight == 4)
		// remove the graphicline, if it's strokeweight is 4 pt
		allGraphicLines.item(i).remove();
-------- code end ----------

You will see, that grouped graphic lines are not removed with the code 
above. You will also remove grouped graphic lines with something like this:
------ code begin --------
// adress every pageItem of the active document
var myItems = app.activeDocument.allPageItems;
// check the type and the strokeweight of every pageitem
for ( var i = myItems.length-1; i >= 0; i-- )
	if (myItems[i].constructor.name == 'GraphicLine' && 
myItems[i].strokeWeight == 4)
		// remove the pageitem, if it's type is graphicline *and* it's 
strokeweight is 4 pt
		myItems[i].remove();
-------- code end ----------


Kind regards
Martin Fischer
Technical Details
Message-ID: <FyAWl.30461$Mf7.15419@newsfe16.iad>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe16.iad.POSTED!611b8288!not-for-mail
References: <1aefdee1-5d30-4d51-8d60-a76d9287b092@d31g2000vbm.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: a938ebf930,4c44e102e3346dd9
X-Google-Attributes: gida938ebf930,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe16.iad.POSTED!611b8288!not-for-mail
From: Martin Fischer <martin.fischer@web.de>
User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
MIME-Version: 1.0
Newsgroups: adobe.scripting.indesign
Subject: Re: remove all Graphic Lines
References: <1aefdee1-5d30-4d51-8d60-a76d9287b092@d31g2000vbm.googlegroups.com>
In-Reply-To: <1aefdee1-5d30-4d51-8d60-a76d9287b092@d31g2000vbm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 43
Message-ID: <FyAWl.30461$Mf7.15419@newsfe16.iad>
X-Complaints-To: abuse@teranews.com
NNTP-Posting-Date: Sat, 06 Jun 2009 20:44:21 UTC
Organization: TeraNews.com
Date: Sat, 06 Jun 2009 22:44:18 +0200