Author Topic: Delete Unused Style Sheets and colors  (Read 2047 times)

0 Members and 1 Guest are viewing this topic.

Joe

  • Guest
Delete Unused Style Sheets and colors
« on: January 12, 2010, 03:31:27 AM »
Hi,

Is there is any script to delete Unused style sheets and colors for multiple files in an folder.

If it is, it will help me to save more time.

Thanks in advance.

Joe

Offline Rabbit

  • Newbie
  • *
  • Posts: 12
  • Karma: 0
  • Gender: Male
Re: Delete Unused Style Sheets and colors
« Reply #1 on: January 15, 2010, 10:37:44 AM »
are you looking for an off the shelf thing or something you write??
Stephen Oakes
Senior Graphic Designer
Oakes Oasis

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: Delete Unused Style Sheets and colors
« Reply #2 on: February 05, 2010, 09:05:15 AM »
funny, I ran
tell document 1 of application "QuarkXPress"
   get properties
end tell


and colors in the document aren't listed.

Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: Delete Unused Style Sheets and colors
« Reply #3 on: February 08, 2010, 02:58:05 AM »
It's just because colors or rather color specs are not properties of a project.
Run get color specs instead. HTH.
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz 10 Go 1066 MHz DDR3 Mac OS 10.8.5 QuarkXPress 9.5.4.1 Adobe CS5 =

Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: Delete Unused Style Sheets and colors
« Reply #4 on: January 03, 2013, 11:06:47 AM »
OK just in case some come here to find a solution, here is a script that will delete every para and char style sheets not used in the current box (feel free to modify it if you want it to scan every story of the doc). It wil also delete every non-default color (again, feel free to modify the code to match your needs). Please note that you'll require the free Satimage.osax for sorting the lists in the handlers. HTH.

Code: [Select]
property DefaultColors : {0, 1, 5, 6, 7, 8} -- these are the uniqueID of the default colors of Quark

tell application "QuarkXPress95"
tell document 1
-- COLORS -> comment the relative lines if you don't want to delete colors
-- NOTE: if you fear some non-default color are used in some used objects or style sheets, you can modify the script in order to get name of color of every generic box, etc.
set TheColors to every color spec
-- FIRST we stock the styles both existing and used
set ListeStylesParagraphes to name of every style spec
set ListeStylesCaracteres to name of every character spec
set StylesParagraphesUtilises to my GetUsedParaStyles()
set StylesCaracteresUtilises to my GetUsedCharStyles()
-- THEN we delete any unused style
-- deleting style spec (paragraph style sheets)
repeat with i from 1 to (length of ListeStylesParagraphes)
if item i of ListeStylesParagraphes is not in StylesParagraphesUtilises then
try
delete style spec (item i of ListeStylesParagraphes)
end try
end if
end repeat
-- deleting character spec (character style sheets)
repeat with i from 1 to (length of ListeStylesCaracteres)
if item i of ListeStylesCaracteres is not in StylesCaracteresUtilises then
try
delete character spec (item i of ListeStylesCaracteres)
end try
end if
end repeat
-- and deleting colors -> comment the following lines if you don't want to delete colors
repeat with AColor in TheColors
if uniqueID of AColor is not in DefaultColors then
delete AColor
end if
end repeat
my Bip(2)
end tell
end tell

on GetUsedParaStyles()
tell application "QuarkXPress95"
tell story 1 of current box of document 1
set TheStyles to name of style sheet of every paragraph
set TheStyles to my SortMyList(TheStyles)
return TheStyles
end tell
end tell
end GetUsedParaStyles

on GetUsedCharStyles()
tell application "QuarkXPress95"
tell story 1 of current box of document 1
set TheCharStyles to name of character style of every text style range
set TheCharStyles to my SortMyList(TheCharStyles)
return TheCharStyles
end tell
end tell
end GetUsedCharStyles

on SortMyList(TheList)
set TheSortedList to sortlist TheList with remove duplicates
return TheSortedList
end SortMyList

on Bip(x)
beep x
end Bip
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz 10 Go 1066 MHz DDR3 Mac OS 10.8.5 QuarkXPress 9.5.4.1 Adobe CS5 =