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

need to read active files illustrator save options

Participant ,
Jun 11, 2017 Jun 11, 2017

Copy link to clipboard

Copied

okay so when you do a save as menu command from illustrator and choose .ai..... you get a number of check boxes to choose how to save it.
The one I'm interested in is the 'pdf compatible' one. it can affect the file size and save times dramatically and I don't really need it left on in many cases.

I want to be able to turn it off with an initial save as command and then if I execute a script to export a pdf then I'd like it to first save the .ai file but stick to what I chose in the first place. The sourceDoc.save(); command I was using up until now just seems to force the default options back onto the file (turning pdfCompatible back on in the process)

So I made some changes to my script so I could use the saveAs command, first for the .ai file and then for the .pdf file.
However, I can't figure out how to read the pdfCompatible setting from the file and use that, the only way I can turn it off is if I force it in the script like this:

var illustratorSaveOpts = new IllustratorSaveOptions();

illustratorSaveOpts.pdfCompatible = false;

                sourceDoc.saveAs( targetFileAI, illustratorSaveOpts );

                sourceDoc.saveAs( targetFile, pdfSaveOpts );

                sourceDoc.close();

I need it to just read what's already in the file and use those options..... just like picking 'save' from the menu.

It's probably something really basic but I've tried everything and can't figure it out. any help would be greatly appreciated!
Cheers

TOPICS
Scripting

Views

940

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 ,
Jun 12, 2017 Jun 12, 2017

Copy link to clipboard

Copied

Hi,you mean

just like picking 'save' from the menu.

so instead of use sourceDoc.save(), you can use:

app.executeMenuCommand('save');

Then the file will be saved with the last used save options, as your expect.

BTW: you can use this snippet to trun off 'pdf compatible' checkbox by default when saving all documents created after that.

app.preferences.setBooleanPreference('aiFileFormat/PDFCompatibility', false);

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
Participant ,
Jun 12, 2017 Jun 12, 2017

Copy link to clipboard

Copied

Thanks moluapple, these are both very helpful,
I didn't even know about the app.executeMenuCommand('save'); command and I probably should have been using that one instead of sourceDoc.save(); all along!

However, it's fine if I just want to save and close my document, but I just realised that I still need to be able to use the SaveAs command in some scripts because to export my PDF's I want to use a script with a saveAs and then save the document back as an AI file so I can continue working on the AI file after that without having to remember to choose it from a menu again. So for example I want to do something like this:

                sourceDoc.saveAs( targetFilePDF1, pdfSaveOpts1 );

                sourceDoc.saveAs( targetFilePDF2, pdfSaveOpts2 😞

                sourceDoc.saveAs( targetFileAI, illustratorSaveOpts );

so as you can see here, I can't just use the executeMenuCommand('save');at the end because it would just keep saving my working file as a .pdf. So at the start I still need to somehow be able to call up the existing IllustratorSaveOptions of the document and save them into my illustratorSaveOpts variable so I can call them up when resaving the AI file again.

sorry for my long winded explanation, I hope you can get what I mean!

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 ,
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

Yes, I know, but we just can not get the save options been used.

And, instead of resaving the AI file again, why not close the active document, and reopen the AI file to continue working on 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
Participant ,
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

LATEST

Oh I see. I figured it would be an easy enough thing to do.

I guess I'll just have to use a workaround and force it to stay off in all of my scripts and just create a seperate script for instances where I want to keep pdfcompatible turned on (probably not too often). seems like a clumsy solution but will do the trick


I had indeed been closing and reopening the document back up until now but it slows down my workflow too much, particularly on larger files. just saving a .pdf and then saving an .ai is generally much much faster.

Thanks for your help moluapple!

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