1

I have a script that takes some 5-10 seconds to execute. I'd like to be able to give the user a very clear indication of when it has finished executing.

My idea for achieving this was to make a layer with a big "...working..." sign painted onto it. The script would make this layer visible at the script's beginning, using something like:

app.activeDocument.artLayers.getByName('...working...').visible = 1

then execute the rest of the script, and finally rehide the layer at the very end.

Unfortunately, this doesn't work, because Photoshop doesn't update the status of the layer until the script has completed. The layer is, in theory, 'shown', but is hidden again in an instant, so the user never actually sees it.

Is there a way to display a layer before the script finishes executing?

Or else, can you think of any other way I can visually notify the user as soon as the script is finished, in a frictionless manner that requires no extra effort on the part of the user (ie. not a popup dialog that requires hitting OK)

Thanks in advance.

Grokify
  • 15,092
  • 6
  • 60
  • 81
Volny
  • 43
  • 1
  • 1
  • 3
  • 1
    Calling `app.refresh()`should force the status of the layer to update. However, consider creating a Progress Bar instead. See the code snippet in [this answer](https://stackoverflow.com/questions/11211323/photoshop-scripting-update-progress-bar-in-a-window#answer-12073105) for a general gist. – RobC Jun 10 '18 at 16:46
  • Perfect answer! This is exactly what I needed. app.refresh() works, so that's good to know for future reference. Though of course the progress bar method is even better in this case. – Volny Jul 09 '18 at 11:42

1 Answers1

1

You should use 'progressbar' ui, which is far better way than showing a layer

You can download and read documentation PDF file about adobe script UI written by Peter Kahrel in this webpage below

http://www.kahrel.plus.com/indesign/scriptui.html

Bad Dobby
  • 811
  • 2
  • 8
  • 22