Skip to main content
Inspiring
June 17, 2020
Answered

Shift+Ctrl+Alt+E Stamp Layer script equivalent

  • June 17, 2020
  • 1 reply
  • 1562 views

A stamp layer is easy via Shift+Ctrl+Alt+E but is pages long in scrptlistener, is there an easy way to scipt this?

This topic has been closed for replies.
Correct answer Kukurykus

Combining the answers and adding a small amount I get this function, it creates the new layer as required, for the stamp layer it does name it as BLUR but for the background only copy it renames the background layer as BLUR and the new layer is Background copy, so I need to get the new layer in focus before the rename action

function stampLayer(){
    if (activeDocument.layers.length > 1){
        var adStampLayer = new ActionDescriptor();
        adStampLayer.putBoolean( charIDToTypeID( "Dplc" ), true );
	executeAction( charIDToTypeID( "MrgV" ), adStampLayer, DialogModes.NO ); }
	
	if (!((lrs = (aD = activeDocument).layers).length - 1) && (bG = lrs[0]).isBackgroundLayer) bG.duplicate();
	
	var docRef = activeDocument
	docRef.activeLayer.name = "BLUR";
	docRef.activeLayer.applyGaussianBlur(20);
    
};

If you want duplication was selected, use this code after bG.duplicate() (before semicolon):

 

, aD.activeHistoryState = (sH = aD.historyStates)[sH.length - 1]

 

1 reply

Inspiring
June 17, 2020

You could try this...

 

 

function stampLayer(){
    var adStampLayer = new ActionDescriptor();
    adStampLayer.putBoolean( charIDToTypeID( "Dplc" ), true );
    executeAction( charIDToTypeID( "MrgV" ), adStampLayer, DialogModes.NO );
};

 

Set the Dplc to false to emulate "Flatten Image", though you can do that in one line by removing adStampLayer and replace it by undefined in executeAction

 

Inspiring
June 17, 2020

many thanks unfortunately i get a message that mrge visible not available in this version of photoshop where there is only 1 layer

Inspiring
June 17, 2020
It will not work if you use the code inside suspendHistory.
 

you have lost me with that answer