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

Error when save file with script. Adobe illustrator

Community Beginner ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

Wrote script to save file.

When try run script in Os mac all is ok, when try it on Windows write this error ( Could not write the file. an assertion has faild )

Why it happens?

IMG_8503.JPG

TOPICS
Scripting , Tools

Views

409

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
Enthusiast ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

What is the script? It's probably a path resolution or OS specific issue.

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
Community Beginner ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

Script just save file in jpg and eps) nothing difficult

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
Enthusiast ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

Impossible to debug something we can't see. Can you post what you have regardless of difficulty? Otherwise you expect us to rewrite everything from scratch instead of just pointing out the issue in your code.

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
Community Beginner ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

no problem) take it))

 

function main () {

 var destFile = '/Users/andrey/Desktop';
 var newFile = new File(destFile);
// save eps and ai
 var saveDoc = app.activeDocument;
 var saveEps = new EPSSaveOptions();
 var saveAi = new IllustratorSaveOptions();
 saveEps.cmykPostScript = false;
 saveEps.embedAllFonts = false;
 saveAi.compatibility = Compatibility.ILLUSTRATOR17;
 saveAi.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
 saveDoc.saveAs( newFile, saveEps );
 saveDoc.saveAs( newFile, saveAi);

// save jpg

 var exportOptions3 = new ExportOptionsJPEG();
 var type3 = ExportType.JPEG;
 var fileSpec3 = new File(destFile);
 exportOptions3.antiAliasing = false;
 exportOptions3.qualitySetting = 100;
 app.activeDocument.exportFile( fileSpec3, type3, exportOptions3 );

}

main();

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
Community Expert ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

Hi,

Could you please try your script by changing

var destFile = '/Users/andrey/Desktop';

to

var destFile = Folder.desktop;

 

So complete script will be like

function main() {
    var destFile = Folder.desktop;
    var newFile = new File(destFile);
    // save eps and ai
    var saveDoc = app.activeDocument;
    var saveEps = new EPSSaveOptions();
    var saveAi = new IllustratorSaveOptions();
    saveEps.cmykPostScript = false;
    saveEps.embedAllFonts = false;
    saveAi.compatibility = Compatibility.ILLUSTRATOR17;
    saveAi.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
    saveDoc.saveAs(newFile, saveEps);
    saveDoc.saveAs(newFile, saveAi);

    // save jpg

    var exportOptions3 = new ExportOptionsJPEG();
    var type3 = ExportType.JPEG;
    var fileSpec3 = new File(destFile);
    exportOptions3.antiAliasing = false;
    exportOptions3.qualitySetting = 100;
    app.activeDocument.exportFile(fileSpec3, type3, exportOptions3);
}

main();

 

Let us know if this works on Windows machine or not.

 

Best regards

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
Community Beginner ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

Thaths error again(( 

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
Guide ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

Please excuse the obvious question, but isn't a root directory required in the path in Windows?  So

 

var destFile = "/C/Users/andrey/Desktop";

 

 

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
Community Expert ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

But I think Folder.desktop will give correct path irrespective of the OS version. 

Best regards

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
Community Expert ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

May be some permission issues with the Desktop path on Windows. Could not write a file is an error related to the permission. So, you can try by chaning permission or path location.

Best regards

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
Advocate ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

LATEST

Salut!

Ce script fonctionne sur CS6 Windows 7

avec une de ces deux lignes:

var destFile = '/Users/René/Desktop';
var destFile = '~/Desktop';

Je ne sais pas comment traduire en français le mot Assertion ? (affirmation)

C'est sur le même ordinateur ?

René

 

 

 

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