I Have photoshop generated script which change current layer name to NewName
Question : It is posible to change that static value to variable value
Here is Code
function Rename() {
// Set
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putString(cTID('Nm '), "NewName");
desc1.putObject(cTID('T '), cTID('Lyr '), desc2);
executeAction(cTID('setd'), desc1, dialogMode);
};
All i want is to remove that "NewName" String
and put variable
defined from outside of function like
var DynamicName = prompt("Your Name","");
so instead of that NewName
i want to call DynamicName
Variable! is that possible?
I want this cuz sometimes i need to change document name or layer name from my old stored variable from script.
app.activeDocument.activeLayer.name = "New name";
, which does exactly the same thing as your Action Manager code in the question. That said, Action Manager code is typically faster. — People use scriptui because they need some input from the user... There's not many other uses. The only one I can think of is a progress bar... I think you are telling me you do after all dislike all of scriptui ;)