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

Is it possible to call "Export As..." from a script?

Community Beginner ,
Oct 29, 2015 Oct 29, 2015

Copy link to clipboard

Copied

I don't see any way to export artboards using a script in a simple way in CC 2015? The only example I can find that uses artboards in a script is "ArtBoards To PDF.jsx" which is included with Photoshop, but it's almost a thousand lines long!

I'd rather just call the "Export As..." command or the "Quick Export" command from my script. Is there any way to do that?

TOPICS
Actions and scripting

Views

612

Translate

Translate

Report

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
Community Beginner ,
Nov 04, 2015 Nov 04, 2015

Copy link to clipboard

Copied

This depends on what your wanting to export exactly.

In the Javascript ref guide page 92 is a method exportDocument(exportIn [, exportAs][, options])  What is does: Exports the paths in the document to an illustrator file, or exports the document to a file with web or device viewing optimizations. 

If thats not what you're looking for, you can try using the Script Listener plugin.  

Votes

Translate

Translate

Report

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
Participant ,
Nov 04, 2015 Nov 04, 2015

Copy link to clipboard

Copied

You can't call "Export As". But you can use  standart "saveAs", like in my script:

experimental-ps-scripts/artboardsToPSD.jsx at master · nvkzNemo/experimental-ps-scripts · GitHub

Votes

Translate

Translate

Report

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
Contributor ,
Nov 05, 2015 Nov 05, 2015

Copy link to clipboard

Copied

I just wanted to Export Shape Layers as .svgs from my script.

Ok, in theory:

1. Put in ScriptListener.8li to Plug-Ins/Automate

2. Right Click on layer, select Export As, choose SVG format, OK.

3. Copy SVG export mess from ScriptingListenerJS.log to my .jsx.

4. Run the .jsx and export all the shaper layers as simple .svgs!

In reality:

1. Put in ScriptListener.8li to Plug-Ins/Automate

2. Right Click on layer, select Export As, choose SVG format, OK.

3. NOTHING IN ScriptingListenerJS.log!!!!!!!

4. Retry

5. Check ScriptingListenerVB.log

6. Retry....

7. Check photoshop-cc-javascript-ref-2015.pdf for DOM solution

8. There is no DOM solution

9. Wet eyes, anger, bitterness. my whole plan is in ruins.


10. Read the forums and google for a few hours without success.


Am I alone who thinks that PS DOM is unfinished?

Votes

Translate

Translate

Report

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 ,
Nov 05, 2015 Nov 05, 2015

Copy link to clipboard

Copied

There are two action in the script listen plugin package download you you have to add to Photoshop, one to turn script listener on and off.  You have to run the one to turn it on before it starts pumping out code to the log.  This should help

Votes

Translate

Translate

Report

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
Contributor ,
Nov 06, 2015 Nov 06, 2015

Copy link to clipboard

Copied

LATEST

Finally I have found the solution how to extract the SVG information from PS.

#include "getLayerSVG.jsx";

params = { documentId: app.activeDocument.id, layerId: app.activeDocument.activeLayer.id, layerScale: 1 };

var svgText = svg.createSVGText( );

A few regular expression replaces() and you have a tiny svg like this:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="99px" height="95px"><path fill-rule="evenodd" fill="rgb(255, 210, 0)" d="M99,60 L48,94 L0,58 L20,0 L81,1 L99,60 Z"/></svg></div>

Votes

Translate

Translate

Report

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