Copy link to clipboard
Copied
I have a psd file with many text levels
I would select them all at once
you think you can do this with a script
thank you
Copy link to clipboard
Copied
Yes you can do that in a script.
/* ==========================================================
// 2015 John J. McAssey (JJMack)
// ======================================================= */
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
// This script will fail when there are text layer that do not have unique layer names
// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher
// bring application forward for double-click events
app.bringToFront();
// ensure at least one document open
if (!documents.length) alert('There are no documents open.', 'No Document');
else main();
///////////////////////////////////////////////////////////////////////////////
// main function
///////////////////////////////////////////////////////////////////////////////
function main() {
var textLayers = new Array;
var numberOfText = 0;
try { textLayers = processArtLayers(activeDocument,numberOfText,textLayers);}
// display error message if something goes wrong
catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }
setSelectedLayers( textLayers )
}
///////////////////////////////////////////////////////////////////////////////
// End - main function
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Function: processsArtLayers
// Input: document or layer set
///////////////////////////////////////////////////////////////////////////////
function processArtLayers(obj,numberOfText,textLayers) {
for( var i = obj.artLayers.length-1; 0 <= i; i--) {
try {
if(obj.artLayers.kind==LayerKind.TEXT) {
textLayers[numberOfText]=obj.artLayers.name
numberOfText++
}
}
catch (e) { }
}
for( var i = obj.layerSets.length-1; 0 <= i; i--) {
processArtLayers(obj.layerSets,numberOfText,textLayers);
}
return textLayers
}
///////////////////////////////////////////////////////////////////////////////
// Function: setSelectedLayers
// Usage: Selects an array of layers
// Input: Array selectedLayers
// Return: <none>
///////////////////////////////////////////////////////////////////////////////
function setSelectedLayers( layerIndexesOrNames ) {
// first select the first one
setSelectedLayer( layerIndexesOrNames[0] );
// then add to the selection
for ( var i = 1; i < layerIndexesOrNames.length; i++) {
addSelectedLayer( layerIndexesOrNames );
}
}
///////////////////////////////////////////////////////////////////////////////
// Function: setSelectedLayer
// Usage: Selects the first layer
// Input: Array selectedLayers
// Return: <none>
///////////////////////////////////////////////////////////////////////////////
function setSelectedLayer( layerIndexOrName ) {
try {
var id239 = charIDToTypeID( "slct" );
var desc45 = new ActionDescriptor();
var id240 = charIDToTypeID( "null" );
var ref43 = new ActionReference();
var id241 = charIDToTypeID( "Lyr " );
if ( typeof layerIndexOrName == "number" ) {
ref43.putIndex( id241, layerIndexOrName );
} else {
ref43.putName( id241, layerIndexOrName );
}
desc45.putReference( id240, ref43 );
var id242 = charIDToTypeID( "MkVs" );
desc45.putBoolean( id242, false );
executeAction( id239, desc45, DialogModes.NO );
}
catch(e) {
alert(e + ":" + e.line); // do nothing
}
}
///////////////////////////////////////////////////////////////////////////////
// Function: addSelectedLayer
// Usage: adds the rest of the layers in the array to the first layer
// Input: Array selectedLayers
// Return: <none>
///////////////////////////////////////////////////////////////////////////////
function addSelectedLayer( layerIndexOrName ) {
try {
var id243 = charIDToTypeID( "slct" );
var desc46 = new ActionDescriptor();
var id244 = charIDToTypeID( "null" );
var ref44 = new ActionReference();
var id245 = charIDToTypeID( "Lyr " );
if ( typeof layerIndexOrName == "number" ) {
ref44.putIndex( id245, layerIndexOrName );
} else {
ref44.putName( id245, layerIndexOrName );
}
desc46.putReference( id244, ref44 );
var id246 = stringIDToTypeID( "selectionModifier" );
var id247 = stringIDToTypeID( "selectionModifierType" );
var id248 = stringIDToTypeID( "addToSelection" );
desc46.putEnumerated( id246, id247, id248 );
var id249 = charIDToTypeID( "MkVs" );
desc46.putBoolean( id249, false );
executeAction( id243, desc46, DialogModes.NO );
}
catch(e) {
alert(e + ":" + e.line); // do nothing
}
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you have CC, you can just use the filter for text layers in the layer panel. If you actually then want to select them all, just press shift-alt/opt-A.
Copy link to clipboard
Copied
Chuck Uebele
I know this function but I did not need to use it that way
anyway thank you for the help.
Thanks to you too JJMack