Illustrator CS: Show All

Hello Again-
Anyone know how to “Show All” in illustrator CS with applescript, currently I can get it to unlock all the layers, but now I need to make everything visable too. Thanks.


		tell application "Illustrator CS"
			activate
			set theImage to open aFile --open and process one of the files
			set thisDoc to current document

			--Begin Unlock of Layers and Sub-Layers

			set tLayers to name of every layer of thisDoc
			tell thisDoc
				repeat with i from 1 to (count tLayers)
					set locked of layer (item i of tLayers) to false
					
					try
						set sLayers to every layer of layer (item i of tLayers)
						repeat with aSLayer in sLayers
							set locked of aSLayer to false
							set locked of every page item of aSLayer to false

<<<<<<<<I would think I would put the Show All right here, but do not know what to put>>>>>>

						end repeat
					end try
				end repeat
			end tell

–mamba :cool:

set visible of every page item of aSLayer to true

Briggs-

Thanks, but that does not work. I get the same error with or without that line of code, “Target Layer cannot be modified”.

When it opens you can see in the layers pallet and on the art board that it does not make things visible. Thanks anyone else have an idea on how to make my script “Show All” of the objects & Layers that have been hidden on the page? Thanks

–mamba :cool:

Figured it out.

set visible of aSLayer to true

tell application "Illustrator CS"
	activate
	set theImage to open aFile
	set thisDoc to current document
	--Begin Unlock of Layers and Sub-Layers
	set tLayers to name of every layer of thisDoc

	tell thisDoc
		repeat with i from 1 to (count tLayers)
			set locked of layer (item i of tLayers) to false
			
			try 
				set sLayers to every layer of layer (item i of tLayers)
				repeat with aSLayer in sLayers
					set visible of aSLayer to true
					set locked of aSLayer to false
					set locked of every page item of aSLayer to false
				end repeat
			end try
		end repeat
	end tell
end tell

Only problem is now it is really slow as it has to go through each layer and make it visible any other ways to just make it “Show All” without having to go through each layer???

–mamba :cool:

Mamba, your putting a repeat loop with in a loop, see if this does what you want any quicker?

tell application "Illustrator CS"
	activate
	set thisDoc to current document
	tell thisDoc
		set locked of every layer to false
		set visible of every layer to true
		repeat with i from 1 to count of layers
			try
				set locked of (layers of layer i) to false
				set visible of (layers of layer i) to true
			end try
		end repeat
		set locked of every page item to false
	end tell
end tell

Here are a few I have been tinkering with a while today…

Levon


--This script will create a list of layers that are hidden. It will unlock and show all layers, then hide only the layers that were originally hidden.

tell application "Adobe Illustrator"
	tell front document
		
		set hiddenLayers to (name of every layer whose visible is false)
		
		repeat with oneLayer in hiddenLayers
			set locked of layer oneLayer to false
			set visible of layer oneLayer to true
		end repeat
		--This initially shows all hidden layers and unlocks all locked layers.
		
		--Then I usually do some file editing here...
		
		--Then I hide just the layers that were hidden originally.
		repeat with oneLayer in hiddenLayers
			set visible of layer oneLayer to false
		end repeat
		
		set allLayers to (name of every layer) as list
		repeat with oneLayer in allLayers
			if name of layer oneLayer contains "slug" then
				set visible of layer oneLayer to false
			end if
		end repeat
		--This is a possible cleanup section if you are trying to standardize files.
		
	end tell
end tell

or just show and unlock the layers:


tell application "Adobe Illustrator"
	tell front document
		set hiddenLayers to (name of every layer whose visible is false)
		repeat with oneLayer in hiddenLayers
			set locked of layer oneLayer to false
			set visible of layer oneLayer to true
		end repeat
	end tell
end tell

Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox 2.0.0.6
Operating System: Mac OS X (10.4)

Hi

this should work as well:

tell application "Adobe Illustrator"
	set properties of every layer of document 1 to {visible:true, locked:false}
end tell

it doesn’t get sublayers i don’t think though!!