Skip to main content
albertomoss
Participant
October 29, 2015
Question

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

  • October 29, 2015
  • 4 replies
  • 735 views

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?

This topic has been closed for replies.

4 replies

oliverIntergrafika
Inspiring
November 6, 2015

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>

oliverIntergrafika
Inspiring
November 5, 2015

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?

d1g1talphyre
Inspiring
November 5, 2015

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

uberplugins
Inspiring
November 4, 2015

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

Participating Frequently
November 4, 2015

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.