moving Photoshop layers w/a variable name?

Can somebody tell me why this doesn’t work:


tell application "Adobe Photoshop CS3"
	set currentlayerSet to current layer of document 1
	log currentlayerSet
	set currentlayerSetName to name of currentlayerSet
	log currentlayerSetName
	
	set NewLayerSet to make new layer set with properties {name:"blah"} at beginning of current document
	set NewLayerSetName to name of NewLayerSet
	log NewLayerSetName
	
move layer set NewLayerSetName to before layer set currentlayerSetName

end tell

I get the following error:
move layer set “blah” to before layer set “y”
“Adobe Photoshop CS3 got an error: Can’t get layer set "blah".”

but this does:


tell application "Adobe Photoshop CS3"
	tell current document
		move layer "x" to before art layer "Y"
	end tell
end tell

Am I missing an escape character or…?

You need to make sure that you are referencing the document in all your lines. While you do in most of your instructions to PS you move line does not. Your second script works because all of the lines are inside a tell block to document 1.

thx.