Expand Symbols in AI

This is an odd request using Ai CS: I am curious if anyone knows a way to take all symbols within a document and automatically expand them (object and fill)? If so, I could attach this script to a close script I am presently using. Problem is, I don’t want to expand any gradients in the process.
thanks,
jeff

Could you post what you’ve got so far?

Here is the entire “Save As EPS” script I have. The primary purpose is to save EPS files with particular EPS options set automatically. It also saves to the correct folder path, if the file had one, yet still allows an operator to change the name of the file and path if need be. And it throws some warnings if one tries to save the file without an “.eps” extension, or if they attempted to save an RGB document.
Over time the script picked up some more cleanup items, such as:
Unlock all layers, unlock all objects, delete all unpainted objects, convert all spots to process, delete all empty layers, delete all hidden objects, and delete all stray points.
It is a very nice script that I got a lot of help with. The only thing I wish it had was a way of determining if a symbol exists, and somehow expand any such symbol?

thanks,
jeff

-- Unlock all layers and items

unlockAll(1)

on unlockAll(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		my unlockAllLayers(1)
		try
			set locked of every page item of document 1 whose locked is true to false
		end try
	end tell
end unlockAll


on unlockAllLayers(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			set allLayers to layers
			repeat with i from 1 to count of allLayers
				set thisLayer to item i of allLayers
				if locked of thisLayer then set locked of thisLayer to false
				if (count of (layers of thisLayer)) > 0 then my unlockAllLayers(thisLayer)
			end repeat
		end tell
	end tell
end unlockAllLayers

-- Delete All Unpainted Items

tell application "Illustrator CS" to activate
deleteUnpainted(1)

on deleteUnpainted(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			try
				set unpainted to (every path item whose clipping is false and filled is false and class of stroke color is no color info)
				delete unpainted
			end try
		end tell
	end tell
end deleteUnpainted

-- Convert all Spots to Process

try
	tell application "Illustrator CS" to set color type of (spots of current document whose name is not "[Registration]" and its color type is spot color) to process color
end try

-- Delete All Empty Layers

property deleteLayers : {}
tell application "Illustrator CS" to activate
deleteEmptyLayers(1)


on deleteEmptyLayers(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		my unlockAllLayers(doc)
		set deleteLayers to {}
		tell doc
			set allLayers to layers
			repeat with i from 1 to count of layers
				set thisLayer to item i of allLayers
				my isLayerEmpty(item i of allLayers)
			end repeat
			delete deleteLayers
		end tell
	end tell
	set deleteLayers to {}
end deleteEmptyLayers

on isLayerEmpty(thisLayer)
	tell application "Illustrator CS"
		set layerIsEmpty to false
		if (count of page items of thisLayer) is 0 then set layerIsEmpty to true
		
		set subLayers to every layer of thisLayer
		if subLayers is not {} then
			set sublayersAreEmpty to {}
			repeat with i from 1 to count of subLayers
				set thisSublayer to item i of subLayers
				set end of sublayersAreEmpty to my isLayerEmpty(thisSublayer)
			end repeat
			if false is in sublayersAreEmpty then set layerIsEmpty to false
		end if
		
		if layerIsEmpty then set end of deleteLayers to thisLayer
		return layerIsEmpty
	end tell
end isLayerEmpty

-- Delete all Stray Points

tell application "Illustrator CS" to activate
deleteStrayPoints(1)

on deleteStrayPoints(doc)
	tell application "Illustrator CS"
		if class of doc is integer or class of doc is string then set doc to document doc
		tell doc
			try
				set strayPts to (every path item whose width is 0 and height is 0)
				set emptyText to every text frame whose contents is "" or contents is " " or contents is (tab as text) or contents is (return as text)
				set deleteItems to strayPts & emptyText
				delete deleteItems
			end try
		end tell
	end tell
end deleteStrayPoints
-- Delete all hidden items

tell application "Illustrator CS"
	activate
	try
		delete (every page item whose visible is false)
	end try
end tell

-- Save the document as EPS -- Warn if RGB

on main()
	tell application "Illustrator CS"
		activate
		if ((count documents) > 0) then
			try
				set CurrentMode to color space of current document
			end try
			if CurrentMode = RGB then
				set userResponse to (display dialog "RGB  ” Click Cancel (Then Fix File)" buttons {"Continue", "Cancel"} default button 2 with icon 2)
				if button returned of userResponse is "No" then return
			end if
			-- Get the path to the current document, if such a path exists.
			try
				set origPath to file path of current document as Unicode text
				-- Rather uselessly, Script Editor and TextEdit return POSIX paths here.
				-- Here's a trap in case Illustrator does the same.
				try
					origPath as alias
				on error
					set origPath to origPath as POSIX file as Unicode text
				end try
			on error
				set origPath to ""
			end try
			
			-- Set a default save name for the document.
			try
				set currentName to name of current document
				if (currentName does not end with ".eps") then set currentName to currentName & ".eps"
			on error
				set currentName to "Untitled.eps"
			end try
			
			-- Prompt for a save name and location. Default to the document's current location
			-- if it has one, otherwise to the last one used by the application.
			if ((count origPath) > 0) then
				set newFile to (choose file name with prompt "Save this document as." default location (origPath as alias) default name currentName)
			else
				set newFile to (choose file name with prompt "Save this document as." default name currentName)
			end if
			
			-- Check that the ".eps" hasn't been lost from the name.
			repeat until ((newFile as Unicode text) ends with ".eps")
				set newFile to (choose file name with prompt "The name you choose must have an ".eps" extension. Save this document as." default name ((newFile as Unicode text) & ".eps"))
			end repeat
			
			-- Create the new file if it doesn't exist.
			try
				open for access newFile
				close access newFile
			end try
			
			-- Save the document to it.
			save current document in newFile as eps with options {class:EPS save options, preview:color Macintosh, embed all fonts:true, embed linked files:false, include document thumbnails:true, compatible gradient printing:true, CMYK PostScript:true, overprint:discard, PostScript:level 3}
			
		end if
	end tell
end main

main()