Scrollable alert
This is very great and handy script! If you have lot of text or numbers, regular alert dialog just roll text out of the screen, and you can’t see them. Here is an example from “ScriptUI for Dummies”, which is a more useful version of alert: it shows text in a scrollable window. An additional advantage is that you can copy text out of the alert. This was posted on Adobe’s InDesign scripting forum.
So, here is function:
function alert_scroll (title, input){ if (input instanceof Array) input = input.join ("\r"); var w = new Window ("dialog", title); var list = w.add ("edittext", undefined, input, {multiline: true, scrolling: true}); list.maximumSize.height = w.maximumSize.height-100; list.minimumSize.width = 550; w.add ("button", undefined, "Close", {name: "ok"}); w.show (); }
Good thing in this script is that if you pass Array, it will be displayed in separate lines for each array object. Now let’s see how to pass data to script.
Pure text pass:
var myArray = 'Here is an example from "ScriptUI for Dummies", which is a more useful version of alert: it shows text in a scrollable window.';
Array case 1:
var myArray = app.documentPresets.everyItem().name;
Array case 2:
var myArray = Array("Item1","Item2","Item3","Item4","Item5");
Displaying result:
alert_scroll ("Alert!", myArray);
Function has two variables. First is for dialog title, and second is for Array that we are passing to function.
Categories: HOT Posts!, InDesign Scripts
InDesign CS3, InDesign CS4, InDesign CS5, Peter Kahrel
Comments (0)
Trackbacks (1)
Leave a comment
Trackback
-
December 29, 2010 at 14:44QuickTip: Find Properties Quickly « InDesign Snippets