Quiero escribir un script para restablecer la escala vertical/horizontal de un objeto inteligente . Intenté usar ArtLayer y muchas de sus propiedades, pero no tuve éxito.
Ejemplo: Ancho: 100 % - Alto: 75 %
app.activeDocument.activeLayer.resize(200,200);
=> Ancho:200 % - Alto:150 %
app.activeDocument.activeLayer.resize(100,100);
=> No pasó nada. ItW:200% - H:150%
¿Hay alguna forma de obtener la Escala Vertical/Horizontal de un SO y configurarla al 100% (escala original)?
Gracias
Aquí está el código "de trabajo":
#target photoshop
try {
var doc = app.activeDocument;
var layers = doc.artLayers;
var size = dialog();
var defaultRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PERCENT;
for (var i = 0; i < doc.artLayers.length -1; i++) {
var activeLayer = doc.artLayers.getByName(doc.artLayers[i].name);
var orUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PERCENT;
activeLayer.resize(size, size, AnchorPosition.MIDDLECENTER);
app.preferences.rulerUnits = orUnits;
}
} catch (e) {
// alert( e );
}
function dialog() {
// Dialog box...
var myWindow = new Window("dialog", "Resize Each Layer");
// Keeps things inline
myWindow.orientation = "row";
// Informational text
myWindow.add("statictext", undefined, "New size ( percentage ):");
// This is the box where the size is inserted
var myText = myWindow.add("edittext", undefined, "");
myText.characters = 5;
myText.active = true;
// Ok....
myWindow.add("button", undefined, "OK");
if (myWindow.show() == 1) return myText.text;
}
Esta es una solución imperfecta basada en cómo se deben ordenar los eventos.
Para usar el script actualmente:
A continuación, intente el script nuevamente (no tiene que deshacer nada en su psd) e intente escribir 150.
Esto debería dar como resultado objetos 2,5 veces su tamaño anterior.
estegatesaurio