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

PDF Script no longer working in Illustrator 2020

Community Beginner ,
Feb 11, 2020 Feb 11, 2020

Copy link to clipboard

Copied

Hi,

 

I was using a script in Illustrator 2019 to save Outlined, Low and High res pdf with a naming convention that was added to the end of the file name (filename_OL_LR, filename_OL_HR etc). This script worked fine all last year until I upgraded to Ai 2020. Now I get 'This file may be read-only' and an 'Error 8700'.

 

Really stumped as to why this is happening. They only thing that has changed is the upgrade to Ai 2020.

 

Script attached.

 

#target Illustrator  
  
var idoc = app.activeDocument;  
var fileName = idoc.fullName;  
var thisFile = new File(fileName);  
  
var saveFile = thisFile.saveDlg();   
if (saveFile)  
    {  
        alert("Ai Saved... Run Ross' amazing PDF script?");  
        idoc.saveAs (saveFile);  
     }  
        else  
        {  
            alert("Didn't work... Soz!");  
        }  


#target illustrator  
  
function outlineDocText(  ) {  
  
          if ( app.documents.length == 0 ) return;  
    
  var docRef = app.activeDocument;  
    
          recurseLayers( docRef.layers );  
    
};  
  
outlineDocText();   
  
function recurseLayers( objArray ) {  
    
          for ( var i = 0; i < objArray.length; i++ ) {  
    
                    // Record previous value with conditional change  
                    var l = objArray[i].locked;  
                    if ( l ) objArray[i].locked = false;  
    
                    // Record previous value with conditional change  
                    var v = objArray[i].visible;  
                    if ( !v ) objArray[i].visible = true;  
    
                    outlineText( objArray[i].textFrames );  
    
                    // Recurse the contained layer collection  
                    if ( objArray[i].layers.length > 0 ) {  
                              recurseLayers( objArray[i].layers )  
                    }  
    
                    // Recurse the contained group collection  
                    if ( objArray[i].groupItems.length > 0 ) {  
                              recurseGroups( objArray[i].groupItems )  
                    }   
    
                    // Return to previous values  
                    objArray[i].locked = l;  
                    objArray[i].visible = v;  
          }  
};  
  
function recurseGroups( objArray ) {  
    
          for ( var i = 0; i < objArray.length; i++ ) {  
    
                    // Record previous value with conditional change  
                    var l = objArray[i].locked;  
                    if ( l ) objArray[i].locked = false;  
    
                    // Record previous value with conditional change  
                    var h = objArray[i].hidden;  
                    if ( h ) objArray[i].hidden = false;  
    
                    outlineText( objArray[i].textFrames );  
    
                    // Recurse the contained group collection  
                    if ( objArray[i].groupItems.length > 0 ) {  
                              recurseGroups( objArray[i].groupItems )  
                    }   
    
                    // Return to previous values  
                    objArray[i].locked = l;  
                    objArray[i].hidden = h;  
          }  
};  
  
  
function outlineText( objArray ) {  
    
          // Reverse this loop as it brakes the indexing  
          for ( var i = objArray.length-1; i >= 0; i-- ) {  
    
                    // Record previous value with conditional change  
                    var l = objArray[i].locked;  
                    if ( l ) objArray[i].locked = false;  
    
                    // Record previous value with conditional change  
                    var h = objArray[i].hidden;  
                    if ( h ) objArray[i].hidden = false;  
    
                    var g = objArray[i].createOutline(  );  
    
                    // Return new group to previous Text Frame values  
                    g.locked = l;  
                    g.hidden = h;  
    
          }  
  
};  

#target illustrator
#targetengine "main"

for (x=0;x<app.documents.length;x++)
{
 var workingDoc = app.documents[x];
 var workingDocFile = workingDoc.fullName;
 var HighPreset = 'High Res';
 var LowPreset = 'Low Res';

// populate these with your settings

 var lowResOpts = new PDFSaveOptions();
 lowResOpts.pDFPreset=LowPreset;

 var highResOpts = new PDFSaveOptions();
 highResOpts.pDFPreset=HighPreset;

 var lowResFile = new 
 File(workingDocFile.toString().replace(".ai","_OL_LR.pdf"));
 workingDoc.saveAs(lowResFile,lowResOpts);

 var highResFile = new 
 File(workingDocFile.toString().replace(".ai","_OL_HR.pdf"));
 workingDoc.saveAs(highResFile,highResOpts);

}

 

If anyone could help I would be eternally grateful!

 

TOPICS
Bug , Scripting

Views

526

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
Community Beginner ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

Can anyone please help?

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 ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

try disabling "Save in Background" in the preferences

 

or try disabling your sync software

 

try both to see which one works best for you.

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

"Save in Background" made no difference im afraid.

 

What do you mean by Sync software? 

 

I am trying to save to a server if that helps?

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

Back Up and Sync sorfware like Google Drive, Dropbox or similar. I get that error sometimes, probably when the file is being uploaded to the back up drive, preventing illustrator to overwrite it.

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 ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

If you are on a Mac, you might benefit from installing an update:

https://community.adobe.com/t5/illustrator/new-update-for-illustrator-24-0-3-mac-only/m-p/10870085?p...

 

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
New Here ,
Nov 04, 2021 Nov 04, 2021

Copy link to clipboard

Copied

LATEST

Hello everyone,

Having the same issuie and cant find any solutions. The cript works fine on local drive, but any attempt to run it on the network the same errors appear. 'This file may be read-only' and an 'Error 8700'

Anybody has a solution?

 

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