Skip to main content
Inspiring
June 17, 2020
解決済み

Shift+Ctrl+Alt+E Stamp Layer script equivalent

  • June 17, 2020
  • 返信数 1.
  • 1577 ビュー

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

このトピックへの返信は締め切られました。
解決に役立った回答 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

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

 

mikew78101280作成者
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

With one layer it won't be possible indeed. You could try this alternative...

 

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