Copy link to clipboard
Copied
I came across a comment on another website to the effect that the global method prompt() will crash PhotoShop if the user types more than 255 characters in the text field. From my brief experience today, I would say that the same limit applies to InCopy and InDesign as well. Has anyone else encountered this?
I guess the next step would be to use ScriptUI to create a text-entry dialog.
... here is a quick version of a Larger Prompt dialog. I just tested and could paste 29,721 characters into it. No idea where that limit comes from.
...text = largerPrompt ("Hello there!");
alert ("you entered "+text.length+" characters");
exit();
function largerPrompt (title)
{
var w = new Window("dialog", title);
var textfield = w.add ("edittext", [0, 0, 500, 300], "", {multiline: true});
textfield.text = "Paste or type text in here\rUse Ctrl+Tab to insert a Tab, Ctrl+Enter to insert
Copy link to clipboard
Copied
I've never encountered such a limit ... but maybe it's because a prompt is for, well ... your basic prompting. Entering more than 200 characters is stretching its intended use The good news is a simple ScriptUI dialog can do the same thing, and you get a multi-line edit box for free. I cannot say anything on a maximum of text that can be entered into it, but I've pasted at least several thousands of characters into one.
Copy link to clipboard
Copied
... here is a quick version of a Larger Prompt dialog. I just tested and could paste 29,721 characters into it. No idea where that limit comes from.
text = largerPrompt ("Hello there!");
alert ("you entered "+text.length+" characters");
exit();
function largerPrompt (title)
{
var w = new Window("dialog", title);
var textfield = w.add ("edittext", [0, 0, 500, 300], "", {multiline: true});
textfield.text = "Paste or type text in here\rUse Ctrl+Tab to insert a Tab, Ctrl+Enter to insert a Hard return";
textfield.active = true;
with (w.add("group"))
{
orientation = "row";
add ("button", undefined, "OK");
add ("button", undefined, "Cancel");
}
if (w.show()==2)
return null;
return textfield.text;
}
Copy link to clipboard
Copied
Thanks so much... I went ahead with the built-in prompt() and put the chore of creating a scriptUI version on my round-to-it list, but this just plugs and plays.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now