🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2538

Re: deleting unused paragraph styles and swatches – ID CS2

#2538
From: kevin_quinn
Date: Mon, 15 Dec 2008 09:53
42 lines
1827 bytes
Hi,

This script will remove unused character styles:

tell application "Adobe InDesign CS2"
	activate
	set theDoc to active document
	tell theDoc
		set myCharacterStyles to every character style of theDoc
		set basedOnStyles to based on of character styles 2 thru -1
		set theCount to count of myCharacterStyles
		repeat with n from (count myCharacterStyles) to 2 by -1
			set myCurrentStyle to item n of myCharacterStyles
			if myCurrentStyle is not in basedOnStyles then
				my RemoveUnusedStyle(myCurrentStyle)
			end if
		end repeat
	end tell
end tell
on RemoveUnusedStyle(myStyle)
	tell application "Adobe InDesign CS2"
		activate
		set find preferences to nothing
		set change preferences to nothing
		set theDoc to active document
		search theDoc with find attributes {applied character style:myStyle}
		tell active document
			set myFoundStyles to search theDoc with find attributes {find text:""}
			if (count myFoundStyles) = 0 then
				try
					delete myStyle
				end try
			end if
		end tell
	end tell
end RemoveUnusedStyle

I'm sorry, but I don't have the time at the moment to integrate it into the other script.

Hope it helps you though.

kev.
Technical Details
Message-ID: <59b72013.8@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b72013.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,4e82dc975bdf3059
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: kevin_quinn@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: deleting unused paragraph styles and
 swatches – ID CS2
Message-ID: <59b72013.8@webcrossing.la2eafNXanI>
Date: Mon, 15 Dec 2008 01:53:19 -0800
References: <59b72013.-1@webcrossing.la2eafNXanI>
Lines: 44
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit