Copy to css with script
Copy link to clipboard
Copied
So i'm trying to find the script that does the "Copy to css" because i would like to automate it within photoshop using a custom script. I've found this link on the forum but it doesn't provide a solution.
https://community.adobe.com/t5/photoshop/how-to-get-the-result-of-quot-layer-copy-css-quot-using-scr...
I'am using photoshop 2020 on mac. Any ideas on where i can find it?
Many thanks
Explore related tutorials & articles
Copy link to clipboard
Copied
The ScriptListener gives this code when the Copy CSS command is executed.
This is it?
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("copyLayerCSS"), d, DialogModes.NO);
Copy link to clipboard
Copied
Thanks for your reply. I've build upon a custom photoshop panel following this tutorial: https://medium.com/adobetech/how-to-create-your-first-adobe-panel-in-6-easy-steps-f8bd4ed5778
I'm trying to build an index.html from a .psd file. So now when a button is clicked in the panel it exports all layers to images and outputs a JSON that is used to build the .CSS file from. But maybe it could be done easier. So what i want to do is with the push of a button export all layers css to a single .css file. I'm not sure but i see your example is VBS script? Is it possible to see a javascript example? Thanks

