here's actually a script that will display the active layer name in a message box. The catch is, it takes up to 3 seconds to run it -I wonder if there's a way to compress the script so it runs faster? Nonetheless here it is, so I'm wondering if there's a way to insert a "CTRL+C" somewhere in the script so it will just copy the layer name and skip the message box part at the end..... var sLayers = getSelectedLayersIdx(); var Names = new Array(); for (var a in sLayers){ Names.push(getLayerNameByIndex( Number(sLayers) ) ); } alert(Names.join('\n')); function getLayerNameByIndex( idx ) { var ref = new ActionReference(); ref.putIndex( charIDToTypeID( "Lyr " ), idx ); return executeActionGet(ref).getString(charIDToTypeID( "Nm " )); }; function getSelectedLayersIdx(){ var selectedLayers = new Array; var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); var desc = executeActionGet(ref); if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){ desc = desc.getList( stringIDToTypeID( 'targetLayers' )); var c = desc.count var selectedLayers = new Array(); for(var i=0;i<c;i++){ try{ activeDocument.backgroundLayer; selectedLayers.push( desc.getReference( i ).getIndex() ); }catch(e){ selectedLayers.push( desc.getReference( i ).getIndex()+1 ); } } }else{ var ref = new ActionReference(); ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "ItmI" )); ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); try{ activeDocument.backgroundLayer; selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" ))-1); }catch(e){ selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" ))); } var vis = app.activeDocument.activeLayer.visible; if(vis == true) app.activeDocument.activeLayer.visible = false; var desc9 = new ActionDescriptor(); var list9 = new ActionList(); var ref9 = new ActionReference(); ref9.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); list9.putReference( ref9 ); desc9.putList( charIDToTypeID('null'), list9 ); executeAction( charIDToTypeID('Shw '), desc9, DialogModes.NO ); if(app.activeDocument.activeLayer.visible == false) selectedLayers.shift(); app.activeDocument.activeLayer.visible = vis; } return selectedLayers; };
... View more