It looks like you swiped code from the Layers to files script, which is a smart place to start, but then you plunked it down in the Layer comps to files script in an area where it's never referenced by the code. Basically you want to take the PNG-8 and PNG-24 code snippets with their respective trim method calls and stick them in the proper case switch, just before the saveFile function is called... and then swap app.activeDocument for docRef since that's variable with your document data that you're passing to the saveFile function.
I uploaded a modified version of the script with these changes here: http://adobe.ly/1vOsgoN, it worked for me on CC 2014 trimming to the transparency. It does JPEG, too
Great name, BTW, I'm not into the whole brevity thing.
Thank you very much, mate.
I've run your script, but it doesn't crop the exported layer comps for me. (Running CC2014) Not sure what I am doing wrong.
I have a psd with two shapes, both have a different height. I run your script, with jpg and and trim selected but the exported jpg's still have the the height of the original psd file.
Really appreciate your help on this.
BTW, Greatest movie of all time :-)
There was a typo on one of the JPG variables. Not sure how it was working for me with that typo. Re-download and try again.
Dude. Thank you, Thank you,Thank you.
Works amazingly well
Thanks a lot for this!
You are god among men. This is an awesome resource and save me a ton of time when building out comps for prototyping!!
Thank you for the amazing script rvrbr8. I do NOT understand why this isn't in the stock 'Layers to Files' script.
I tried to use this in CC 2015 and for JPGs it works, but not for PNGs. For PNGs, the whole transparent artboard is part of the file, but is trimmed off for JPEG, regardless of transparency settings.
Any ideas? Obviously the 'trim' function DOES work in some cases, but not in Photoshop CC 2015 using this script: Adobe Creative Cloud
I have also tried it in Photoshop CC 2015 and it didn't work.
It is still exporting files without the trim. Please help!
It would be massive improvement to the workflow
Created a separate batch action to crop PNGs and ran it after running the script and worked fine.