Pixnub Home Forums EZ Green Screen EZGS Extract Image command Reply To: EZGS Extract Image command

#7026908
Damon Bell
Keymaster

    I made a test version of EZ Green Screen with the command and the updated manifest file. The command itself works….. but not sure if it will work for you batching which I explain below.

    Here is the download link.

    https://pixnub.com/downloads/ez-green-screen-8-0-2-test.ccx

    The panel ID is ezgs8 and the command ID is ezgsCommand. Here are the code lines you need.

    
    await plugin.showPanel("ezgs8");
    await plugin.invokeCommand("ezgsCommand");
    
    

    Here is the issue…..

    UXP uses asynchronous javascript. The javascript doesn’t wait for showPanel or invokeCommand before processing the next line of code. Even when using await, it seems to ignore that for these. So the first time you open PS, if you haven’t opened EZ Green Screen then it will try to run the command before the panel opens. Then if you run it again it will run the command because it doesn’t have to wait for the panel. However, whatever your plugin does after EZ Green Screen won’t wait for EZ Green Screen to finish first. It will try to process the next line of code after the invokeCommand while EZ green Screen is still processing.

    You could maybe try wrapping the invokeCommand inside of another function and await on that but I don’t think that will work as that function would still complete while EZGS is running.

    You could also try using a crafty batch method using setTimout() to force it to wait a certain amount of time to extract before moving on to the next step. Then you would need to ensure the time was always greater then the extraction time. That is a clunky workaround though.

    Anyway, I think this is a Photoshop bug or a design flaw, not sure which. Download the EZGS 8.0.2 test version and try it out. Let me know if yo find a solution. Also, disregard the magenta upgrade notice. It will show that in 8.0.2 until I make 8.0.2 the official release on the server.

    • This reply was modified 8 months, 1 week ago by Damon Bell.
    • This reply was modified 8 months, 1 week ago by Damon Bell.
    • This reply was modified 8 months, 1 week ago by Damon Bell.