if (documents.length > 0)
{
FreeLayerDuplicate ("Set 1");
}
else
{
alert("There must be at least one open document.");
}
function FreeLayerDuplicate ( ActiveLayerOrLayerSet )
{
var ref12 = new ActionReference();
var ref13 = new ActionReference();
var desc17 = new ActionDescriptor();
ref12.putClass( charIDToTypeID( "Dcmn" ) );
desc17.putReference( charIDToTypeID( "null" ), ref12 );
ref13.putName( charIDToTypeID( "Lyr " ), ActiveLayerOrLayerSet.toString() );
desc17.putReference( charIDToTypeID( "Usng" ), ref13 );
executeAction( charIDToTypeID( "Mk " ), desc17, DialogModes.NO );
}
if (documents.length > 0)
{
TargetedLayerDuplicate ("Untitled-2");
}
else
{
alert("There must be at least one open document.");
}
function TargetedLayerDuplicate ( TargedDocName )
{
var desc19 = new ActionDescriptor();
var ref15 = new ActionReference();
var ref16 = new ActionReference();
ref15.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc19.putReference( charIDToTypeID( "null" ), ref15 );
ref16.putName( charIDToTypeID( "Dcmn" ), TargedDocName.toString() );
desc19.putReference( charIDToTypeID( "T " ), ref16 );
executeAction( charIDToTypeID( "Dplc" ), desc19, DialogModes.NO );
}