Skip to main content
Participant
January 13, 2023
Answered

Exporting Adobe Illustrator to Photoshop Script

  • January 13, 2023
  • 2 replies
  • 924 views
 Apologies for what I suspect will be a relatively simple fix, I'm quite new to scripting/coding. I've been trying to figure out how to export a .ai file from Illustrator to a .psd Photoshop file.
 
When I attempt to export from .ai to .jpg, this code works fine:

 

var myDoc = app.activeDocument;
myDoc.exportFile("C:/Users/Home/Downloads/Blank3.jpg", ExportType.JPEG)

 

However, I always get the error message 1320-Invalid Enumeration Value when I attempt the same with Photoshop like this:

 

var myDoc = app.activeDocument;
myDoc.exportFile("C:/Users/Home/Downloads/Blank3.PSD", ExportType.Photoshop)

 

I've checked the documentation, which specifically called out that for photoshop I must include the file
extension (PSD) in the file specification, but that hasn't helped. What am I doing wrong? 

This topic has been closed for replies.
Correct answer femkeblanco

1.  The first arguement should be a file, not just a path.

2.  Despite what the documentation shows, the constant should be all caps.

 

app.activeDocument.exportFile(new File("C:/Users/Home/Downloads/Blank3.PSD"), ExportType.PHOTOSHOP);

 

2 replies

femkeblanco
femkeblancoCorrect answer
Legend
January 13, 2023

1.  The first arguement should be a file, not just a path.

2.  Despite what the documentation shows, the constant should be all caps.

 

app.activeDocument.exportFile(new File("C:/Users/Home/Downloads/Blank3.PSD"), ExportType.PHOTOSHOP);

 

Participant
January 14, 2023

Thanks! Capitalizing the constant was what did it.

Mylenium
Legend
January 13, 2023

It's probably something with the export options you need to set. Some of that stuff doesn't work without explicitly setting some of those options. Check this:

 

https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsPhotoshop.html

 

Mylenium