Illustrator guides

Hi

I’m new to all this & I was wondering if there’s any way to automate the “clear guides” in CS4.
I’ve got various scripts that save out to PDF/ai & outline the fonts etc, I would just like to add this functionality to the script, any ideas?

Cheers.

tell application "Adobe Illustrator"
	tell the current document
		delete (every path item whose guides is true)
	end tell
end tell

I don’t think it cares wether they are locked or NOT.

Actually, it does matter. You first have to unlock al layers and make them all visible.

You may not want to change the visibilities and locks of the layers, so I have the script write down those properties in a list and re-apply them in the second half.

tell application "Adobe Illustrator"
	tell the current document
		-- Write down which layers are locked and visible
		set layerLocks to locked of every layer
		set layerVisibilities to visible of every layer
		-- Unlock all layers and
		-- make them all visible
		set locked of every layer to false
		set visible of every layer to true
		-- Delete all guides
		delete (every path item whose guides is true)
	end tell
end tell

-- Cycle through all layers and re-apply
-- original visiblities and locks
set i to 1
repeat while i ≤ (count of layerLocks)
	set currentLayerLock to item i of layerLocks
	set currentLayerVisibility to item i of layerVisibilities
	tell application "Adobe Illustrator"
		tell current document
			tell layer i
				set visible to currentLayerVisibility
				set locked to currentLayerLock
			end tell
		end tell
	end tell
	set i to i + 1
end repeat