Page 1 of 1
					
				PSD insignia and Duplicate as PNG
				Posted: Sun Jul 18, 2021 11:03 am
				by SimplSam
				In Moho 13 (
R.I.P) PSD images were distinguished from other normal images with the PSD insignia. It would be great if we could have that feature back.
It also had a handy 'Duplicate as PNG' feature. It would be great to have that also but with some prompts about naming/location/prefix etc.
and in an ideal world the Type of layer would also be 'PSD Image' or 'Image PSD' as opposed to 'Image' - so that they are searchable/filterable.
and in an even more ideal world there would be access to a script function DuplicateLayerAsPng.
 
			 
			
					
				Re: PSD insignia and Duplicate as PNG
				Posted: Sun Jul 18, 2021 12:00 pm
				by synthsin75
				If you want a hack in the meantime, drop this into your tool folder to silently prefix every PSD layer name with "(PSD) ", when selected. 
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "Syn_PSDLabel"
-- **************************************************
-- General information about this script
-- **************************************************
Syn_PSDLabel = {}
function Syn_PSDLabel:Name()
	return "PSD Label"
end
function Syn_PSDLabel:Version()
	return "0.1"
end
function Syn_PSDLabel:Description()
	return "Label PSD layers"
end
function Syn_PSDLabel:Creator()
	return "©2021 J.Wesley Fowler (synthsin75)"
end
function Syn_PSDLabel:UILabel()
	return "SYN: PSD Label"
end
-- **************************************************
-- The guts of this script
-- **************************************************
function Syn_PSDLabel:ColorizeIcon()
	return true
end
function Syn_PSDLabel:IsRelevant(moho)
	--label PSD layers
	if (moho.layer:LayerType() == MOHO.LT_IMAGE) then
		local prefix = "(PSD)"
		local len = 5
		local name = moho.layer:Name()
		if (moho:LayerAsImage(moho.layer):IsPSDImage()) then
			if (name:sub(1,len) ~= prefix) then
				moho.layer:SetName(prefix .. " " .. name)
			end
		else
			if (name:sub(1,len) == prefix) then
				layer:SetName(name:sub(len+2))
			end
		end
		moho:UpdateUI()
	end
	return false
end
 
			 
			
					
				Re: PSD insignia and Duplicate as PNG
				Posted: Sun Jul 18, 2021 3:07 pm
				by SimplSam
				Thanks. I am playing with a variation of this and TAGS as I need to preserve the layer names.