1 person found this helpful
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.
works (so far). -- thanks a lot!
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.
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?
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.
OK, thanks for the insight. It's valuable information.