Looking for a way to update smart objects from PSB via script
I've written several scripts to automate a lot of this image pipeline I'm working on.
The last problem to solve is this:
Setup:
Primary PSD -> Contains several layers that are smart object to a secondary PSB
Secondary PSB -> Has several groups, inside each group are other smart objects/layers
My current manual steps:
1. Secondary PSB -> Make 'next' group visible
2. Secodary PSB -> Save PSB (ctrl+s)
3. Photoshop updates smart objects
4. switch back to Primary PSD document
5. Export As PNG
6. Choose name {SecondaryPSB_GroupName.png}
repeat 1-6 several times
I have scripts that I can modify to accomodate most of 1, 5 and 6. I'm having trouble finding examples where the script saves the PSB as the same filename, and then I'm not sure of a solid approach to waiting for step 3 to complete, can sometimes take 40+ seconds
I tried something like this, but it is either silently failing (I'm pretty sure) and/or it just isn't updating the smart object.
function SaveCurrentDoc(destinationFolder, shouldClose){
var psdOptions = new PhotoshopSaveOptions();
psdOptions.embedColorProfile = true;
psdOptions.alphaChannels = true;
psdOptions.layers = true;
psdOptions.spotColors = true;
var doc = activeDocument;
doc.saveAs(new File(destinationFolder + '/' + doc.name.split('.')[0] + '.psb'), psdOptions);
if(shouldClose){
doc.close(SaveOptions.DONOTSAVECHANGES);
}
}
