Skip to main content
This topic has been closed for replies.
Correct answer CarlosCanto

if you're using the latest CC version, use this line

app.activeDocument.exportSelectionAsPNG(File("c:/temp/selection.png"));

1 reply

Alexander Ladygin
Inspiring
May 25, 2018

function exportFile is only for activeDocument, and yet - swap the format and path

// app.activeDocument.exportFile(exportFile, exportFormat [, options])

app.activeDocument.exportFile(File("~/Desktop/temp/1.png"), ExportFormat.PNG);

kkl_marvelmedia
Participating Frequently
May 25, 2018

I tried this and it exports entire artboard, including all the objects. How do we export only selected object instead?

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
May 25, 2018

if you're using the latest CC version, use this line

app.activeDocument.exportSelectionAsPNG(File("c:/temp/selection.png"));