Modal Execution: Multiple BatchPlay Calls Vs. 1 BatchPlay Call

I just experimented a bit with the new modal execution.
The documentation says:

If the modal state lasts a significant amount of time (currently more than two seconds), then a progress bar is shown

Based on my testing results, this is only true for executing separate batchPlay calls while Photoshop is in modal state. If you group up multiple descriptors in one batchPlay call, the progess bar will not show up - it might briefly flash at the end though.

I felt like there’s also some difference in execution time, so I’ve ran an example where I create 200 new layers using both approaches, 3 times each:

1) Multiple batchPlay calls


photoshop.action.batchPlay([createLayerDescriptor], {})
photoshop.action.batchPlay([createLayerDescriptor], {})
photoshop.action.batchPlay([createLayerDescriptor], {})

Time needed:
Run 1: 10439 milliseconds
Run 2: 10516 milliseconds
Run 3: 10522 milliseconds

(Progress bar shows up)

2) One batchPlay call

photoshop.action.batchPlay([createLayerDescriptor, createLayerDescriptor, createLayerDescriptor, ...], {})

Time needed:
Run 1: 6182 milliseconds
Run 2: 5968 milliseconds
Run 3: 5981milliseconds

(Progress bar doesn’t show up)

Looks like you can cut the time almost in half if you’re fine with not showing the progess bar.

Old ExtendScript do allow you to do both. It would be also nice to have both in UXP.

1 Like

I agree. Progress bars can be helpful and everything, but in some cases where the user performs a task many times and knows that the plugin will take a few seconds, the progress bar is kind of unnecessary.

I didn’t remember doProgress() nor doForcedProgress(), thanks for pointing them out!

I feel a new video in the UXP series might be upcoming :slight_smile:

1 Like

This was added in PS 2015 or 2015.5
Not that old as everything else.