Last active
September 4, 2018 23:13
-
-
Save jameslockman/46cd08e89bb563505dd39d0e5db23e38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#targetengine main | |
try { | |
//for PS and ID, we need the display name of the Color Settings file. This is what you see in Edit>ColorSettings | |
var colorSettingsFile = "North America Prepress 2"; | |
if (app.name === "Adobe InDesign") { | |
//InDesign uses app.colorSettings.cmsSettings | |
app.colorSettings.cmsSettings = colorSettingsFile; | |
//alert("Color Settings are now: " + app.colorSettings.cmsSettings); | |
} else if (app.name === "Adobe Photoshop") { | |
//PS uses app.colorSettings | |
app.colorSettings = colorSettingsFile; | |
//alert("Color Settings are now: " + app.colorSettings); | |
} else if (app.name === "Adobe Illustrator") { | |
//Special case for AI, which has an array of all available Color Settings. | |
//We need to find the specific color settings file in the array, then get | |
//its display name so we can use it to set the Color Settings | |
//for AI, we need the file name of the specific Color Settings file you want to select. | |
var settingFile = getAIColorSettingFile('North America Prepress.csf'); | |
if (settingFile) { | |
app.loadColorSettings(settingFile); | |
//alert("Color Settings are now: " + settingFile.displayName); | |
} | |
} | |
//this function finds the Display Name of the Color Settings file and returns that file. | |
function getAIColorSettingFile(name) { | |
var settingIdx = app.colorSettingsList.length - 1; | |
var matchToFileLowerCaseName = name.toLowerCase(); | |
var settingFile = null; | |
while (!settingFile && settingIdx >= 0) { | |
settingFile = app.colorSettingsList[settingIdx]; | |
var settingFileLowerCaseName = settingFile.displayName.toLowerCase(); | |
if (settingFileLowerCaseName != matchToFileLowerCaseName) { | |
settingFile = null; | |
settingIdx--; | |
} | |
} | |
return settingFile; | |
} | |
} catch (e) { | |
alert("Could not set Color Settings to " + colorSettingsFile, "Color Setting Warning", true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment