Photoshop export selected layer sets

Hi guys,

I have a simple problem but i can’t find an answer anywhere. So here it is.

In photoshop CS4 i have 4 layer sets (Layer A,Layer B,Layer C,Layer D).
I want to export some of them separately. (Layer A, Layer B and Layer D.)

Is there a way to export only my selected layers.

Here’s the script i made to export every layer set of the current document.


tell application "Adobe Photoshop CS4"
	
	set fileList to name of every layer set in current document
	
	if (count layer set in current document) > 0 then		
		set myDoc to current document
		set properties of layer sets in myDoc to {visible:false}
		set myLayerSetCount to (count layer set in myDoc)
		
		repeat with i from 1 to myLayerSetCount
			set myLayerSet to layer set i in myDoc
			set properties of myLayerSet to {visible:true}
			set myOptions to {class:save for web export options, web format:PNG, transparency:true, png eight:false}
			set myFileName to name of myLayerSet
			set myFilePath to (path to desktop) as text
			export myDoc in (myFilePath & myFileName & ".png") as save for web with options myOptions
			set properties of myLayerSet to {visible:false}
		end repeat
		
		set properties of myLayerSet to {visible:true}		
	else
		display alert "There is no layer set in your document!" message "You need at least 1 layer set to run this script." buttons {"Ok"} default button 1 as warning
		return
	end if
end tell

Thanks!

To my knowledge the ‘current layer’ only returns the first of the selected layers. It is the same for Javascript with its ‘activeLayer’ it has been requested that this be changed to a list/array.