Convert each layer to individual smart object script not working
I often find my self with PSD files that have many layers that need to be individually converted to Smart Objects. To save time I used to use this Photoshop .jsx script all the time to convert the multiple layers in to individual Smart Objects. I must have messed it up some how, or not sure if something changed with scripting in the newest version. Not sure how to fix it.
//-------------------------------------------------------------------------
function convertEachLayerToSmartObject(){
var resultLayers=new Array();
try{
var idGrp = stringIDToTypeID( "groupLayersEvent" );
var descGrp = new ActionDescriptor();
var refGrp = new ActionReference();
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
executeAction( idGrp, descGrp, DialogModes.NO );
for (var ix=0;ix< llen; l++ ) {
app.activeDocument.activeLayer = resultLayers[l]
executeAction(stringIDToTypeID('newPlacedLayer'), undefined, DialogModes.NO);
}
return resultLayers;
}
convertEachLayerToSmartObject();
The dialogue box error I get is:
Error 15: Try without catch or finally. Line: 18 ->

Is there a better script out there for this? Or a better way to do this, without having to individually right click each layer Convert to Smart object? thank you!!
