Skip to main content
adrienr76677621
Participant
August 25, 2015
Answered

[JSX] Run a script more than once at the same time ?

  • August 25, 2015
  • 2 replies
  • 451 views

Hi everyone,

I have a script that make some photoshop montage on a picture I put in argument. Right now I am able to launch this script one at a time. If I launch the script twice (on different image) it bug don't process the two correctly.
I might want to make a sort of a multithreading of this script. Is it a matter of a script, like never use "app.activeDocument" or is it a different way to start the document you want to process ? Or even, is this possible at all?

Thanks for your answers,

This topic has been closed for replies.
Correct answer Chuck Uebele

Moving post to Photoshop Scripting forum.

You can only run one script at a time. You can create a script that batch processes your images, or you can run your script in the batch or image processor, if you first create an action to run your script.

2 replies

matias.kiviniemi
Legend
August 26, 2015

Multithreading is basically impossible with scripts, it blocks the whole app. But you should be able to basically wrap your script with

var n = app.documents.length

for (var i=0; i<n; i++) {

  // initialize any variables you assumed to null

  app.activeDocument = app.documents

  // your script

}

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
August 25, 2015

Moving post to Photoshop Scripting forum.

You can only run one script at a time. You can create a script that batch processes your images, or you can run your script in the batch or image processor, if you first create an action to run your script.