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

Exporting Adobe Illustrator to Photoshop Script

Community Beginner ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

 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? 

TOPICS
Import and export , Scripting

Views

166

Likes

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

correct answers 1 Correct answer

Guide , Jan 13, 2023 Jan 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);

 

Likes

Translate

Translate
LEGEND ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

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

Likes

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
Guide ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

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);

 

Likes

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
Community Beginner ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

LATEST

Thanks! Capitalizing the constant was what did it.

Likes

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