Reputation: 196
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
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