//Main routine
//helps adding the CMYK & RBG profiles variables
var main = function() {
var doc = app.properties.activeDocument,
cmyk, rgb;
if ( !doc ) return;
//Creating CMYK profile variable
setVariable (doc, “CMYK profile”, doc.cmykProfile);
//Creating RGB profile variable
setVariable (doc, “RGB profile”, doc.rgbProfile);
}
//generic function for adding a text variable
var setVariable = function(doc, varName, varContent )Â {
var v = doc.textVariables.itemByName ( varName );
if ( !v.isValid ) {
v = doc.textVariables.add({name:varName});
}
v.variableOptions.contents = varContent;
}
//Let’s go
main();