• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Text Edit Colom Wise

Participant ,
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

987

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

Valorous Hero , Jun 22, 2021 Jun 22, 2021

So I misunderstood you.

 

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

Votes

Translate

Translate
Adobe
Valorous Hero ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

try before assignment 

 

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

 

Votes

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
Participant ,
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

Votes

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
Participant ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

Can you send full code of assigment 

Votes

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
Valorous Hero ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

textItemRef.contents = str;

 

this is an assignment

 

 

p.s. del

Votes

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

Votes

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
Valorous Hero ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

So I misunderstood you.

 

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

Votes

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
Participant ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

Thanku so much @r-bin  Well

Votes

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

 

Votes

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