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

Change Illustrator Color Settings on MacOS with JavaScript/ExtendScript?

Participant ,
May 13, 2024 May 13, 2024

Question:
Is there a way to set the Color Settings in Illustrator on MacOS with ExtendScript via the Document Preset so those color settings will be applied at the creation of the new document?

 

Use Case:
I have an Illustrator ExtendScript that will import images and arrange them on a layout along with specific metadata. In most cases, all of the images being placed should be tagged with the same profile. I'm grabbing the profile associated with the first image and would like to set the Color Settings to the settings associated with that profile (which I know) before I create the document to avoid profile mismatch warnings when placing the images.

 

MacOS Testing:
In simplied terms for testing, was thinking something like the following may work, but it's not changing the settings:

 

 

var myColorSettings = "North America Newspaper";
var docPreset = new DocumentPreset;
docPreset.colorSettings = myColorSettings;
var doc = app.documents.addDocument(DocumentColorSpace.CMYK, docPreset);

 

 

I also I tried the following variations of myColorSettings as well with no success:

  • ~/Library/Application%20Support/Adobe/Color/Settings/Recommended/North%20America%20Newspaper.csf
  • /Library/Application%20Support/Adobe/Color/Settings/Recommended/North%20America%20Newspaper.csf
  • North%20America%20Newspaper.csf
  • North%20America%20Newspaper
  • North America Newspaper.csf
  • North America Newspaper

 

Any ideas how to accomplish this?

TOPICS
How-to , Scripting , SDK
486
Translate
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

Participant , May 13, 2024 May 13, 2024

Found the solution here to set the Color Settings:

var filespec = new File('/Library/Application%20Support/Adobe/Color/Settings/Recommended/North%20America%20Newspaper.csf'); 
app.loadColorSettings(filespec);




Translate
Adobe
Community Expert ,
May 13, 2024 May 13, 2024

Seems you may just have the `addDocument()` method arguments in the wrong order. The docs (found here) show the order as `app.documents.addDocument(startupPreset [, presetSettings] [, showOptionsDialog])`...

 

startupPreset

String

Startup preset to use

presetSettings

DocumentPreset, optional

Preset document template

showOptionsDialog

Boolean, optional

Whether to show options dialog

 

Obviously, I don't have your "North America Newspaper" preset but I tried the below with the built-in "Mobile" preset and it seems to work fine.

 

var docPreset = new DocumentPreset();
docPreset.colorMode = DocumentColorSpace.CMYK;
var doc = app.documents.addDocument("Mobile", docPreset);

 

 Let me know if this works or if I misunderstood your issue. Cheers!

Translate
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 ,
May 13, 2024 May 13, 2024

Hey @jduncan, apologies if I wasn't clear. The "Mobile" setting you are referring to appears to be a "Document Profile". What I'm referring to are the Color Settings found under Edit » Color Settings » Settings. I'm looking for a way to set those before I create the Illustrator file to avoid profile mismatch warnings. Thought perhaps it could be done using a Document Preset, either by telling it which CMYK Working Space to use (icc profile), or the Color Settings file itself, but that may have been a pipe dream?

I don't know that I can change those settings with ExtendScript?

Translate
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 ,
May 13, 2024 May 13, 2024
LATEST

Found the solution here to set the Color Settings:

var filespec = new File('/Library/Application%20Support/Adobe/Color/Settings/Recommended/North%20America%20Newspaper.csf'); 
app.loadColorSettings(filespec);




Translate
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