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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.