Copy link to clipboard
Copied
In this script, After type the text only row not column ?
I want type Column Wise In this script....
1:- Original Image
2:- After Edit the Text Only Row Show Not Column
// dialogue
var dlg = new Window ("dialog", "TTTTTTTT");
dlg.add ("statictext", undefined, "ANNNNNNNN !");
var textContents = "No text";
// check to see if active layer is text
if (app.activeDocument.activeLayer.kind == "LayerKind.TEXT")
{
var textItemRef = app.activeDocument.activeLayer.textItem;
textContents = textItemRef.contents;
}
// add edit text
var edText = dlg.add ("edittext", [0,0,220,20]);
edText.text = textContents;
edText.alignment = "left";
edText.active = true;
//button group
var btnGroup = dlg.add ("group");
btnGroup.orientation = "row";
btnGroup.alignment = "center";
btnGroup.orientation = "row";
// add buttons
btnGroup.add ("button", undefined, "OK");
btnGroup.add ("button", undefined, "Cancel");
dlg.center();
var myReturn = dlg.show();
if (myReturn == 1)
{
// set checkboxes and input here
var ask = edText.text;
// call the function to change text
doThatThingThatYouDo(ask);
}
function doThatThingThatYouDo(str)
{
// check to see if active layer is text
if (app.activeDocument.activeLayer.kind == "LayerKind.TEXT")
{
var textItemRef = app.activeDocument.activeLayer.textItem;
textItemRef.contents = str;
}
alert(str);
}
So I misunderstood you.
str = str.replace(RegExp("\\s", "g"), "\r");
Copy link to clipboard
Copied
try before assignment
str = str.replace(RegExp("\\n", "g"), "\r");
Copy link to clipboard
Copied
New line can't be insert
If I type Google SEO...
I Apper in Photoshop
SEO
Copy link to clipboard
Copied
Can you send full code of assigment
Copy link to clipboard
Copied
textItemRef.contents = str;
this is an assignment
p.s. del
Copy link to clipboard
Copied
I write the assignment but doesnot effect
I write two Word Google Seo
First Line:- Google
Second Line:- SEO
// dialogue
var dlg = new Window ("dialog", "TTTTTTTT");
dlg.add ("statictext", undefined, "ANNNNNNNN !");
var textContents = "No text";
// check to see if active layer is text
if (app.activeDocument.activeLayer.kind == "LayerKind.TEXT")
{
var textItemRef = app.activeDocument.activeLayer.textItem;
textContents = textItemRef.contents;
}
// add edit text
var edText = dlg.add ("edittext", [0,0,220,20]);
edText.text = textContents;
edText.alignment = "left";
edText.active = true;
//button group
var btnGroup = dlg.add ("group");
btnGroup.orientation = "row";
btnGroup.alignment = "center";
btnGroup.orientation = "row";
// add buttons
btnGroup.add ("button", undefined, "OK");
btnGroup.add ("button", undefined, "Cancel");
dlg.center();
var myReturn = dlg.show();
if (myReturn == 1)
{
// set checkboxes and input here
var ask = edText.text;
// call the function to change text
doThatThingThatYouDo(ask);
}
function doThatThingThatYouDo(str)
{
// check to see if active layer is text
if (app.activeDocument.activeLayer.kind == "LayerKind.TEXT")
{
var textItemRef = app.activeDocument.activeLayer.textItem;
str = str.replace(RegExp("\\n", "g"), "\r");
textItemRef.contents = str;
}
alert(str);
}
Copy link to clipboard
Copied
So I misunderstood you.
str = str.replace(RegExp("\\s", "g"), "\r");
Copy link to clipboard
Copied
Thanku so much @r-bin Well
Copy link to clipboard
Copied
You can use first proposed snippet if you also change 2 lines of your original to:
var edText = dlg.add ("edittext", [0,0,220,20], '', {multiline: true});
and:
btnGroup.add("button",undefined,"Close").onClick=function(){dlg.close(1)};