Photoshop Rename layer if layer exists?

I need to rename “Original Layer” to Original Image" When this layer exists. In photoshop

How would I do this?

This is part of a larger script.

tell current document
			
			--If the quick mask mode has been left on then delete the channel Quick Mask
			if (quick mask mode) then delete channel "Quick Mask"
			
			if layer "Original Layer" then make "Original Layer" with properties {name:Original Image}
					end tell

I’ve been trying this, but I get this error

[center]error “Can’t make «class cCLr» 1 of document "DE00ER515.psd" of application "Adobe Ph[/center]otoshop CS6" into type boolean.” number -1700 from «class cCLr» 1 of document “DE00ER515.psd” to boolean

tell application "Adobe Photoshop CS6"
	
	
	tell current document
		
		if (quick mask mode) then delete channel ¬
			"Quick Mask"
		if layer "Original Layer" then ¬
			set OriLayer to "Original Layer"
		
		set OriLayer to make layer with properties {name:"Original Image"}
		
		delete layer "Original Image"
		
	end tell
end tell

Hi. The particular test you’re trying to perform requires exists to arrive at a boolean.

if (exists layer "Original Layer") then...

Alternatively, you could direct a command inside a try block; it will attempt to perform your operation, where possible.

try
tell layer "Original Layer" to set name to "Original Image"
end try

I’d recommend downloading Adobe’s (free) scripting guide for PS; it’s fairly helpful in regards to syntax and commands.

That did it many Thanks

tell application "Adobe Photoshop CS6"
	
	
	tell current document
		
		if (quick mask mode) then delete channel ¬
			"Quick Mask"
		if (exists layer "Original Layer") then ¬
			tell layer "Original Layer" to set name to "Original Image"
		
		
		
	end tell
end tell

There is no need to delete channel “Quick Mask” if quick mask mode is on.

Just set it to false

set quick mask mode to false

Greets from
TMA