Automatically synchronize CC Color Settings via a script

Color Settings Synchronization in Bridge

Color Settings Synchronization in Bridge

I have been asked many times over the years about Color Settings and how to synchronize them. Most people use Bridge’s Synchronize Color Settings tool, found at Edit>Color Settings…, but there are cases where organizations want to ensure that all workstations have the same Color Settings. It is possible to install a script that will set the Color Settings to a specific value. In this article, we’ll learn how to set the Color Settings in Photoshop, Illustrator and InDesign.

Photoshop, Illustrator, InDesign and many other CC desktop applications are scriptable using Javascript. You can launch scripts from the applications’ Scripts menu, or you can trigger scripts via events. In this case, we’ll use the Startup event. InDesign and Illustrator have Startup Scripts folders, and each will execute any scripts you put there when they start. Photoshop has an event manager that lets you attach specific scripts to events, such as startup or document open. We’ll look at the scripts first, and then we’ll see how to activate them.

The script

I’ve prepared a script that works for Illustrator, InDesign and Photoshop, which we can do by detecting which application is running the script. For InDesign and Photoshop, we need to set the value of an application property to set the Color Settings file, and for Illustrator, we need to call a function to set the Color Settings file. For InDesign and Photoshop, the property will be the name of the Color Settings as shown in the Color Settings dialog, so you will need to open a CC desktop app and choose Edit>Color Settings… in order to see the name of the Color Settings file you want. For Illustrator, you need the name of the .csf file. For this example, we’ll use “North America Prepress 2,” which is a built-in Color Settings file that ships will all CC installations, and which is included as “North America Prepress.csf” in all CC installations. If you make a custom Color Settings file, you will need to make note of its file name and the name that shows in the Color Settings dialog.

The property we need to set in Photoshop is called app.colorSettings. In InDesign, this property is called app.colorSettings.cmsSettings. In Illustrator, we need to call the app.loadColorSettings() method with a pointer to the specific file we want to set as the Color Settings. The script below tests for which host application and selects the proper method for setting the Color Settings. View SetColorSettings.jsx on gist.

#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);
}

Installation and activation

As seen below, you can create a folder in the InDesign and Illustrator application folder for startup scripts. For Illustrator, make a folder called Startup Scripts in the application folder. For InDesign, there should already be a folder called startup scripts in the Scripts folder. Create these folders in Illustrator and InDesign, and copy SetColorSettings.jsx into the two Startup Scripts folders.

Startup Folders in AI and ID

Startup Folders in AI and ID

Photoshop requires additional steps, rather than just making a Startup Scripts folder. Choose Edit>Scripts>Scripts Events Manager… to open the Events Manager. You’ll need to activate Events, so click on the box to Enable Events to Run Scripts/Actions.

Script Events Manager

Script Events Manager

Once activated, you can browse to your script to attach it to the Start Application event. Make sure that Start Application is selected in the Photoshop Event menu, then click on the Script dropdown menu and choose Browse… Browse to your script, which could be one of the versions stored in one of the Startup Scripts folders from AI and ID. Select it, Click Done, then click Add to register the event. Click Done to finish setting up the startup event.

Script Events Manager

Script Events Manager

Under the hood, Photoshop has created files called Script Events Manager.xml and tw0001.dat that are stored in the Photoshop Settings folder in the user’s Preferences folder. You can create these files by hand, too. The xml file is just a list of registered events and additional scripts that will appear in the menu. The .dat file is the specific scripts that will run based on the event having fired.

Once you have the scripts installed, each time you start Photoshop, Illustrator or InDesign, they will automatically set their Color Settings to North America Prepress 2.

Share on Facebook

Comments are closed.