I apologize if this has already been answered, but I could not find it in my searches:
I'm trying to run an external program (in this case a python script) from my photoshop javascript.
I figured out that I can use the File.execute() function to run an program but can I get Photoshop to wait for it to finish execution before continuing to the next line?
If that isn't possible, can I make a delay statement to wait 1 or 2 seconds before continuing?
Thanks in advance!
Running an external program and waiting for completion
-
Paul MR
Running an external program and waiting for completion
One way would be to use a flag file and get your Python script to remove the file at the end of it's process. IE.
Code: Select allvar pythonScript = File(Folder.desktop + "/myPython.py");
var pyFlag = File(Folder.desktop + "/Python Flag");
pyFlag.open('w');
pyFlag.close();
pythonScript.execute();
while(true){if(!pyFlag.exists) break;}
$.writeln("Python script completed ");
Code: Select allvar pythonScript = File(Folder.desktop + "/myPython.py");
var pyFlag = File(Folder.desktop + "/Python Flag");
pyFlag.open('w');
pyFlag.close();
pythonScript.execute();
while(true){if(!pyFlag.exists) break;}
$.writeln("Python script completed ");