Text Edit Colom Wise

Explorer ,
Jun 22, 2021 Jun 22, 2021

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

PT.JPG

 

2:- After Edit the Text Only Row Show Not Column

pt1.JPG

 

// 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);
}

TOPICS
Actions and scripting

Views

769

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Jun 22, 2021 Jun 22, 2021
So I misunderstood you. str = str.replace(RegExp("\\s", "g"), "\r");

Likes

Translate

Translate
Adobe Community Professional ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

try before assignment 

 

str = str.replace(RegExp("\\n", "g"), "\r");

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

New line can't be insert 

If I type Google SEO...

I Apper in Photoshop

Google

SEO

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

Can you send full code of assigment 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

textItemRef.contents = str;

 

this is an assignment

 

 

p.s. del

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 22, 2021 Jun 22, 2021

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);
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

So I misunderstood you.

 

str = str.replace(RegExp("\\s", "g"), "\r");

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

Thanku so much @r-bin  Well

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

LATEST

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)};

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines