Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Copy to css with script

Explorer ,
Oct 01, 2020 Oct 01, 2020

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

TOPICS
Actions and scripting
367
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
People's Champ ,
Oct 01, 2020 Oct 01, 2020
What exactly do you want?
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);
 
Copying is done to the clipboard.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 02, 2020 Oct 02, 2020
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines