Copy link to clipboard
Copied
Hi peeps,
I'm creating a script for converting 27.000 white background product images with clipping path to transparent .png files. these images have 2 different types.
- pruduct image with white background and a clipping path around the product
- effect picture of product in use
Right now i created 2 scripts.
1. deletes the white background with help from clipping path selection.
2. just exports as png
The problem i'm facing is that when i run the first script, the script skips the images without a path and keeping them open in tabs. at the moment i need to run another batch on the tabs that were not run through the script. this slows the computer down because out of a batch of 1000 pictures around 30% are images that need to run script 2 and. so that means that 300 tabs of pictures will be open in photoshop.
I would like to combine the 2 script so that when action 1 from script 1 cant be done, then run script 2 for that image.
Copy link to clipboard
Copied
Frankly, I would not have two scripts. I would rewrite them to be in one script and use an if else statement to handle each file then close each file.
Copy link to clipboard
Copied
This will be similar to the following script:
Perhaps something like this:
#target photoshop
try {
activeDocument.pathItems[0].select();
//alert("A path exists!");
app.doAction("Action 1", "Action Set 1");
} catch (e) {
//alert("A path doesn't exist!");
app.doAction("Action 1", "Action Set 2");
}
You will need to change the references to the Actions and Action Sets to match those in your screenshot of the Action panel.
P.S. Actions and Scripts are two different things, Photoshop doesn't have "Action Scripts". Your screenshot shows an Action. As there are no conditional path Actions, you'll need a script like the JavaScript above.
Copy link to clipboard
Copied
@Joeri5E20 - So, how did you go?