This content has been marked as final. Show 10 replies
I use type of 'window',not type of 'dialog'.
It does work, but it the window is displayed for the duration of the script. And as your script is pretty short, the window isn't going to stay on your screen very long. In this respect it "window"-type windows behave like palettes.
Thanks for your reply.
How can I let the window stay on my screen long time?Can you give me some examples?
I can't use palettes type with JS in indesign .
>How can I let the window stay on my screen long time?
I guess that the window will stay on screen as long as the script is running -- just like a palette.
>I can't use palettes type with JS in indesign.
My window can't stay on my screen for a long time,it only flashed short time.I don't know the reason.
Can you give me some examples like a 'pelette' or 'window'?
I use a message window (a palette) to display what a script is up to when it is running. A script that processes a bunch of files could display each file name in succession:
// create a message window
mess = create_mess (30, 'Example');
docs = // get a bunch of documents
for (i = 0; i < docs.length; i++)
// show the current file's name in the message window
mess.text = app.activeDocument.name;
function create_mess (le, title)
dlg = new Window('palette', title);
dlg.alignChildren = ['left', 'top'];
var txt = dlg.add('statictext', undefined, '');
txt.characters = le;
Thanks Peter,I'll have a try!
A new question!
I hope the "palette" always stay on my screen like a dialog,but I can't let it work so well.
I need a float window(it can switch to the application),but I can't get this effect.
My friends,anyone can give me the answer?
You're probably not using a persistent scripting engine.
If not, what ID does is start a new engine, run your script, then kill the engine. When this is the case, your window/palette will flash on the screen, but then your script ends, the engine is killed, and the window or palette goes away.
You must use a persistent scripting engine when using ScriptUI.
To do so, place these lines at the top of your script:
Of course, MyEngine can be any name for your persistent scripting engine.
My friend,thanks a bunch.
Your answer is right and very detailed,my code does work great.