// Copyright 2007 // Written by Jeffrey Tranberry // Photoshop for Geeks Version 1.0 /* Description: This script will name the slice with the currently active layer's name */ // enable double clicking from the // Macintosh Finder or the Windows Explorer #target photoshop // Make Photoshop the frontmost application // in case we double clicked the file app.bringToFront(); /////////////////////////// // MAIN // /////////////////////////// nameLayerBasedSlice(); /////////////////////////// // FUNCTIONS // /////////////////////////// // function created using the Scripting Listener // to capture the command for Layer>New Layer Based Slice function nameLayerBasedSlice(){ var id2488 = charIDToTypeID( "setd" ); var desc298 = new ActionDescriptor(); var id2489 = charIDToTypeID( "null" ); var ref168 = new ActionReference(); var id2490 = stringIDToTypeID( "slice" ); var id2491 = charIDToTypeID( "Ordn" ); var id2492 = charIDToTypeID( "Trgt" ); ref168.putEnumerated( id2490, id2491, id2492 ); desc298.putReference( id2489, ref168 ); var id2493 = charIDToTypeID( "T " ); var desc299 = new ActionDescriptor(); var id2494 = charIDToTypeID( "Nm " ); desc299.putString( id2494, app.activeDocument.activeLayer.name ); var id2495 = stringIDToTypeID( "sliceImageType" ); var id2496 = stringIDToTypeID( "sliceImageType" ); var id2497 = charIDToTypeID( "Img " ); desc299.putEnumerated( id2495, id2496, id2497 ); var id2498 = stringIDToTypeID( "slice" ); desc298.putObject( id2493, id2498, desc299 ); executeAction( id2488, desc298, DialogModes.NO ); }