# Modal Execution: Multiple BatchPlay Calls Vs. 1 BatchPlay Call

**URL:** <https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371>\
**Category:** Photoshop\
**Tags:** api-feedback\
**Created:** [July 24, 2021, 1:54pm UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371 "2021-07-24T13:54:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonhenke](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/simonhenke/32/957_2.png) [@simonhenke](https://forums.creativeclouddeveloper.com/u/simonhenke)\
**Post date:** [July 24, 2021, 1:54pm UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371/1 "2021-07-24T13:54:21Z")

</div>

I just experimented a bit with the new modal execution.  
The [documentation](https://www.stage.adobe.io/photoshop/uxp/ps_reference/media/executeAsModal/) 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**

Code:

```auto
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**

Code:  
`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.

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [July 24, 2021, 3:01pm UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371/2 "2021-07-24T15:01:19Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/b/b98fbd8b299e5107ef8b48498c322a698e25dbed.png)

---

<div class="post-metadata">

**Author:** ![simonhenke](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/simonhenke/32/957_2.png) [@simonhenke](https://forums.creativeclouddeveloper.com/u/simonhenke)\
**Post date:** [July 25, 2021, 11:04am UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371/3 "2021-07-25T11:04:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DavideBarranca](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/davidebarranca/32/1523_2.png) [@DavideBarranca](https://forums.creativeclouddeveloper.com/u/DavideBarranca)\
**Post date:** [July 31, 2021, 3:36pm UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371/4 "2021-07-31T15:36:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [July 31, 2021, 5:49pm UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371/5 "2021-07-31T17:49:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [July 31, 2021, 6:35pm UTC](https://forums.creativeclouddeveloper.com/t/modal-execution-multiple-batchplay-calls-vs-1-batchplay-call/3371/6 "2021-07-31T18:35:14Z")

</div>

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