@Lital2252941669o3 wrote:
but i need the possibility to input a diffrent paragraph each time (i have 100 diffrent ones for 40 diffrent banner sizes)
is there a way to do this for a panel like the find and replace where i could input text?
OK, here is a new version using a single scriptUI dialog rather than two separate prompts:

/*
Unlimited Input Find & Replace.jsx
v1.0 - 17th May 2023, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/find-and-replace-text-wont-work-on-long-text/td-p/13793461
*/
// Configure the text parameters to pass to the main window function
// Non breaking space character \u00A0 to avoid truncation on Win OS
findReplaceDialog("Find & Replace Interface v1.0", "Find:\u00A0", "Replace (No 255 Character Limit):\u00A0");
// Main function
function findReplaceDialog(promptTitle, promptString, promptString2) {
try {
// PROMPT WINDOW
var promptWindow = new Window("dialog");
promptWindow.text = promptTitle;
/*
var gra = dialog.graphics;
//var uiBrush = gra.newBrush(gra.BrushType.SOLID_COLOR, [0.3, 0.3, 0.3, 1]);
var uiBrush = gra.newBrush(gra.BrushType.THEME_COLOR, "appDialogBackground"
gra.backgroundColor = uiBrush;
*/
promptWindow.preferredSize.width = 340;
promptWindow.preferredSize.height = 260;
promptWindow.orientation = "column";
promptWindow.alignChildren = ["left", "top"];
promptWindow.spacing = 15;
promptWindow.margins = 20;
// FIELD GROUP
var fieldGroup = promptWindow.add("group", undefined, {
name: "fieldGroup"
});
fieldGroup.orientation = "column";
fieldGroup.alignChildren = ["left", "center"];
fieldGroup.spacing = 5;
fieldGroup.margins = 0;
// FIND PROMPT FIELD LABEL
var promptLabel = fieldGroup.add("statictext", undefined, undefined, {
name: "promptLabel"
});
promptLabel.text = promptString;
promptLabel.preferredSize.height = 25;
promptLabel.preferredSize.width = 300;
// Option - swap undefined for "bold" if required
promptLabel.graphics.font = ScriptUI.newFont("dialog", undefined, 13);
/*
// TEXT COLOR
promptLabel.graphics.foregroundColor = promptLabel.graphics.newPen(promptLabel.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);
*/
// FIND PROMPT FIELD
var promptField = fieldGroup.add('edittext {properties: {name: "promptField", multiline: true, scrollable: true}}');
promptField.helpTip = "Find:";
// Default text
promptField.text = "";
//promptField.preferredSize.width = 300;
promptField.alignment = ["fill","center"];
promptField.preferredSize.height = 75;
promptField.active = true;
// REPLACE PROMPT FIELD LABEL
var promptLabel2 = fieldGroup.add("statictext", undefined, undefined, {
name: "promptLabel2"
});
promptLabel2.text = promptString2;
promptLabel2.preferredSize.height = 25;
promptLabel2.preferredSize.width = 300;
// Option - swap undefined for "bold" if required
promptLabel2.graphics.font = ScriptUI.newFont("dialog", undefined, 13);
/*
// TEXT COLOR
promptLabel.graphics.foregroundColor = promptLabel.graphics.newPen(promptLabel.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);
*/
// REPLACE PROMPT FIELD
var promptField2 = fieldGroup.add('edittext {properties: {name: "promptField2", multiline: true, scrollable: true}}');
promptField2.helpTip = "Replace:";
// Default text
promptField2.text = "";
//promptField2.preferredSize.width = 300;
promptField2.alignment = ["fill","center"];
promptField2.preferredSize.height = 75;
// BUTTON GROUP
var buttonGroup = promptWindow.add("group", undefined, {
name: "buttonGroup"
});
buttonGroup.orientation = "row";
buttonGroup.alignChildren = ["left", "top"];
buttonGroup.spacing = 0;
buttonGroup.margins = 0;
// CANCEL BUTTON
var cancelButton = buttonGroup.add("button", undefined, undefined, {
name: "cancelButton"
});
cancelButton.text = "Cancel";
cancelButton.justify = "left";
// OK BUTTON
var okButton = buttonGroup.add("button", undefined, undefined, {
name: "okButton"
});
okButton.text = "OK";
okButton.justify = "left";
// RENDER THE WINDOW & OK BUTTON ACTION
if (promptWindow.show() === 1 && (promptField.text !== "") && (promptField2.text !== "")) {
// Code to run on OK
findReplaceText();
} else {
//app.beep();
//alert("Script cancelled!");
}
// FUNCTION TO RUN WHEN THE OK BUTTON IS PRESSED
function findReplaceText() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putProperty(s2t("property"), s2t("replace"));
reference.putEnumerated(s2t("textLayer"), s2t("ordinal"), s2t("allEnum"));
descriptor.putReference(s2t("null"), reference);
descriptor2.putString(s2t("find"), promptField.text); // Find
descriptor2.putString(s2t("replace"), promptField2.text); // Replace
descriptor2.putBoolean(s2t("checkAll"), true);
descriptor2.putBoolean(s2t("forward"), true);
descriptor2.putBoolean(s2t("caseSensitive"), false);
descriptor2.putBoolean(s2t("wholeWord"), false);
descriptor2.putBoolean(s2t("ignoreAccents"), true);
descriptor.putObject(s2t("using"), s2t("findReplace"), descriptor2);
executeAction(s2t("replace"), descriptor, DialogModes.NO);
}
} catch (err) {
alert("There was an unexpected error!" + "\r" + err + ' ' + err.line);
}
}