Copy link to clipboard
Copied
hi everyone!
for an indesign script I want to have a palette window with sliders to be able to change certain values and instantly observe the results. but right at the start I ran into trouble.
a simple script like
var window = new Window("palette", "title");
var result = window.show();
will work in the extendscript ide or in bridge, but not in indesign! (all cs3, windows)
a normal dialog window works though.
I think the documentation somewhere mentions that photoshop doesn't support palette windows, but nothing is said about indesign -- that's why I assumed that it should actually work.
any ideas?
thanks!
w
InDesign (like Photoshop) runs every script in a new scripting engine. When the script is done executing, the scripting engine goes away. So if you're showing a palette, it goes away too (very quickly). If you're showing a modal dialog, the script hasn't completed, and the dialog remains.
To show a palette, you have to run it from a persistent, named scripting engine. You create one of those using the #targetengine directive in your script. Even then, the to run it from the ESTK, the engine must
...Copy link to clipboard
Copied
InDesign (like Photoshop) runs every script in a new scripting engine. When the script is done executing, the scripting engine goes away. So if you're showing a palette, it goes away too (very quickly). If you're showing a modal dialog, the script hasn't completed, and the dialog remains.
To show a palette, you have to run it from a persistent, named scripting engine. You create one of those using the #targetengine directive in your script. Even then, the to run it from the ESTK, the engine must already exist. You can place a small script in a folder named "startup scripts" underneath the Scripts folder for InDesign. When ID starts, it looks for all jsx files contained in folders named "startup scripts" underneath "Scripts" (and it's a hierarchical search - it will look downline in all folders) and runs them, creating persistent scripting engines for all those that have the targetengine directive.
In PS, you can't create a persistent engine yourself. Meanwhile, PS does have 1 persistent engine for BridgeTalk, so you can send a BT message to PS to request it to open a palette.
Bob
Copy link to clipboard
Copied
works (so far). -- thanks a lot!
Copy link to clipboard
Copied
LOL -
Oh, it'll work alright. I've done some crazy stuff with ScriptUI. It can be a bit verbose to code; but, it's pretty solid. If you run into a problem, post away. I'll give you as much help as I can.
Bob
Copy link to clipboard
Copied
Bob,
#targetengine "session"
lets me create a palette without having to create a named scripting engine of my own.
Am I correct in understanding that this uses the existing InDesign session?
Steve Caine
Copy link to clipboard
Copied
You are correct, ID does have an engine named "session". I don't recommend doing using it though. If you consider what could happen if a user had 10 scripts written for the session engine, you could run into unexpected trouble. The "session" engine has (just like any other engine) a single global namespace. If two scripts get loaded into that engine which have identically named functions, running the second script will replace the first script's version of the function.
The safest way to go is to always create your own engine.
Bob
---
Copy link to clipboard
Copied
OK, thanks for the insight. It's valuable information.
Steve
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more