0

In ExtendScript, I've run up against a very strange scenario with which I need some help from a ScriptUI guru. I've got a huge InDesign script that, during the course of its execution, displays a progress bar in a palette window. (var w = new Window("palette", "Progress");) I would like this palette to be closed when the script is finished, so I added a w.close() at the end of the script.

However, this only occurs if the focus is still in InDesign. Some of our people like to work on other tasks while the InDesign script is running on another screen in the background, which is fine, but when they return to InDesign, that progress bar palette is still on the screen, showing 100% completion. This palette window can be moved around, but it cannot be closed, even if the little red 'x' in the corner is clicked. This eventually leads to multiple palettes staying on the screen throughout the day, as this script is called dozens of times in a normal workday.

Reading Peter Kahrel's excellent guide to ScriptUI, I learned that all palettes remain in memory, even after being closed with .close(). I want them completely erased from memory and purged, so they don't stay on the screen if the user switches to another application while the script is running. Any ideas on how to accomplish this?

By the way, I wanted to include some sample code so you could see for yourself, but it doesn't seem to work when it's just some small code called from with the ESTK; only in my 4,647-line production script. Thus, I cannot paste any example code.

RobC
  • 22,977
  • 20
  • 73
  • 80
Sturm
  • 689
  • 2
  • 23
  • 52
  • which ID version are you and your team using? – fabianmoronzirfas Feb 06 '14 at 08:22
  • Currently CS6. Not sure if we'll be upgrading to CC in the future. – Sturm Feb 06 '14 at 14:18
  • Maybe an update to CC and an approach with Extension Builder 3 would be a better way. It is still in beta but you can create real dock able panels. I know it does not solve your problem but I've been at the exact same point. My tool got to big. So I separated multiple processes out into separate scripts. Having a panel all the time open did not work well. The only Adobe Application that can handle that well is After Effects with it's dock able panels. – fabianmoronzirfas Feb 06 '14 at 19:08
  • 1
    Maybe this helps: from "Javascripts Tools Guide": > `$.gc ()` > Initiates garbage collection in the JavaScript engine. [link](http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/scripting/pdfs/javascript_tools_guide.pdf) Page 219 – fabianmoronzirfas Feb 06 '14 at 19:14
  • Sadly, I don't think our company will _ever_ update to CC and _most definitely_ not in the near future. As for the Garbage Collection idea--it was a good one, but I'm afraid that doesn't work, either. – Sturm Feb 06 '14 at 20:33

2 Answers2

1

You could reuse the window between script runs by making it a global variable and using

#targetengine 'my_target_engine_name'

which would mean that the users only have one annoying window open. It's not a solution, but combined with Trevor's position trick it might be an acceptable hack.

ryecroft
  • 352
  • 2
  • 9
  • Yep, I have discovered that much, so at least if a progress bar palette happens to remain visible after the script is done, it will revert back to being a usable progress bar palette the next time the script is run. I'll have a look at Trevor's hack. – Sturm Nov 05 '14 at 15:26
0

Don't know if your still interested but you can normally use var w = new Window ("palette", "My Window Title"); and then w.visible = false or w.location.y = 10000 or w.size = [0,0]. Not very nice solutions but easy to apply

Trevor
  • 525
  • 2
  • 6
  • 19