PHennessey
PHennessey

Reputation: 196

How can I convert layer to smart object in Photoshop?

This script converts the active layer into a smart object:

createSmartObject(app.activeDocument.activeLayer);
function createSmartObject(layer)
{
    var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
    executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}

My question: Is there a shorter way to code this?

Upvotes: 7

Views: 3406

Answers (1)

brandonbee
brandonbee

Reputation: 41

createSmartObject();
function createSmartObject() {
    var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
    executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}

You don't need to pass the layer into the function--it acts upon whatever the current active layer happens to be.

Upvotes: 3

Related Questions