Copy link to clipboard
Copied
// Switch off any dialog boxes
displayDialogs = DialogModes.NO; // OFF
// call the source document
var srcDoc = app.activeDocument;
var numOfLayers = srcDoc.layers.length;
var vCount = 0;
var hCount = 0;
// main loop
for (var i = numOfLayers -1; i >= 0 ; i--)
{
// get a referenec to each layer as we loop over them
var thisLayer = srcDoc.layers[i];
// get the layer bounds of each layer as you go
srcDoc.activeLayer = thisLayer;
var lb = get_layer_bounds();
// set a variable to for portrait or landscape
var portrait = true;
// if layer is wider than it is long,
// it's landscape
if (lb[0] > lb[1]) portrait = false;
//alert(lb[0] + "," + lb[1] + "\n" + portrait + "\n" +thisLayer.name);
// ignore the background layer
// if there is one
if (thisLayer.isBackgroundLayer == false)
{
if (portrait)
{
srcDoc.artLayers[i].name = "VFrame";
// add one to the horizontal count
hCount +=1
}
else
{
srcDoc.artLayers[i].name = "HFrame";
// add one to the vertical count
vCount+=1
}
}
}
var docName = srcDoc.name.substring(0, srcDoc.name.length -4);
var imgName = vCount + "v" + hCount + "h_" + docName + "_0001.psd";
duplicateIt(imgName);
// Set Display Dialogs back to normal
displayDialogs = DialogModes.ALL; // NORMAL
// function GET LAYER BOUNDS ()
// ----------------------------------------------------------------
function get_layer_bounds()
{
var x = parseFloat(app.activeDocument.activeLayer.bounds[0]);
var y = parseFloat(app.activeDocument.activeLayer.bounds[1]);
var x1 = parseFloat(app.activeDocument.activeLayer.bounds[2]);
var y1 = parseFloat(app.activeDocument.activeLayer.bounds[3]);
var selW = parseFloat(x1-x);
var selH = parseFloat(y1-y);
// return the results as an array
return [selW, selH];
}
{
if (arguments.length == 0) str = "temp";
var id428 = charIDToTypeID( "Dplc" );
var desc92 = new ActionDescriptor();
var id429 = charIDToTypeID( "null" );
var ref27 = new ActionReference();
var id430 = charIDToTypeID( "Dcmn" );
var id431 = charIDToTypeID( "Ordn" );
var id432 = charIDToTypeID( "Frst" );
ref27.putEnumerated( id430, id431, id432 );
desc92.putReference( id429, ref27 );
var id433 = charIDToTypeID( "Nm " );
desc92.putString( id433, str ); // name
executeAction( id428, desc92, DialogModes.NO );
}
Copy link to clipboard
Copied
Only Selected Layer Rename horizontally and vertically By ?
Copy link to clipboard
Copied
// Switch off any dialog boxes
displayDialogs = DialogModes.NO; // OFF
// call the source document
var srcDoc = app.activeDocument;
var numOfLayers = srcDoc.layers.length;
var vCount = 0;
var hCount = 0;
// main loop
for (var i = numOfLayers -1; i >= 0 ; i--)
{
// get a referenec to each layer as we loop over them
var thisLayer = srcDoc.layers[i];
// get the layer bounds of each layer as you go
srcDoc.activeLayer = thisLayer;
var lb = get_layer_bounds();
// set a variable to for portrait or landscape
var portrait = true;
// if layer is wider than it is long,
// it's landscape
if (lb[0] > lb[1]) portrait = false;
//alert(lb[0] + "," + lb[1] + "\n" + portrait + "\n" +thisLayer.name);
// ignore the background layer
// if there is one
if (thisLayer.isBackgroundLayer == false)
{
if (portrait)
{
srcDoc.artLayers[i].name = "VFrame";
// add one to the horizontal count
hCount +=1
}
else
{
srcDoc.artLayers[i].name = "HFrame";
// add one to the vertical count
vCount+=1
}
}
}
var docName = srcDoc.name.substring(0, srcDoc.name.length -4);
var imgName = vCount + "v" + hCount + "h_" + docName + "_0001.psd";
duplicateIt(imgName);
// Set Display Dialogs back to normal
displayDialogs = DialogModes.ALL; // NORMAL
// function GET LAYER BOUNDS ()
// ----------------------------------------------------------------
function get_layer_bounds()
{
var x = parseFloat(app.activeDocument.activeLayer.bounds[0]);
var y = parseFloat(app.activeDocument.activeLayer.bounds[1]);
var x1 = parseFloat(app.activeDocument.activeLayer.bounds[2]);
var y1 = parseFloat(app.activeDocument.activeLayer.bounds[3]);
var selW = parseFloat(x1-x);
var selH = parseFloat(y1-y);
// return the results as an array
return [selW, selH];
}
{
if (arguments.length == 0) str = "temp";
var id428 = charIDToTypeID( "Dplc" );
var desc92 = new ActionDescriptor();
var id429 = charIDToTypeID( "null" );
var ref27 = new ActionReference();
var id430 = charIDToTypeID( "Dcmn" );
var id431 = charIDToTypeID( "Ordn" );
var id432 = charIDToTypeID( "Frst" );
ref27.putEnumerated( id430, id431, id432 );
desc92.putReference( id429, ref27 );
var id433 = charIDToTypeID( "Nm " );
desc92.putString( id433, str ); // name
executeAction( id428, desc92, DialogModes.NO );
}
How to Only Selected Layer Rename horizontally and vertically by..... ?
Copy link to clipboard
Copied
Only Selected Layer Rename horizontally and vertically no all layera Only Selected Layer Rename plz help me sir........
Copy link to clipboard
Copied
Hello, please post a full sentence of what you are trying to do in your native language, so that we can translate it and know what you are tryig to achieve.
Is it for a commercial venture? I often see posts that are rather demands, and I am always afraid that some might make money on the back of the work of benevolent coders.
Copy link to clipboard
Copied
Hello , thanks to reply... I Am album designer ..need to personal use not to other....
Only Selected Layer can Rename on " horizontally and vertically " ( HFrame & VFrame)... not to All Layer Rename