Reputation: 6949
I'm trying to remove colour profiles from a document. As far as I am aware, the colorProfileName should be either a string or null (if it's not assigned). However, if it's the latter I can't assign it to a variable (line 3).
Without the try/catch is there a way around this?
try {
var cp = app.activeDocument.colorProfileName;
} catch(eek) {
alert("no colour profile associated with image");
cp = null;
}
if (cp != null) {
cp = assignNoColourProfile(cp);
if (cp == null) {
alert("colour profile now removed");
}
}
Upvotes: 0
Views: 466
Reputation: 2282
I only have access to Photoshop CS5 and the description of colorProfileName says:
Valid only when colorProfileType = ColorProfile.CUSTOM or WORKING.
So maybe it's a good idea to check that before:
var cp = null;
if (app.activeDocument.colorProfileType != ColorProfile.NONE)
cp = app.activeDocument.colorProfileName;
Michael / Hamburg
Upvotes: 2