script : an Illustrator error occurred: 1346458189 ('MRAP')
Hello everyone,
to match whether swatch contains a spot color. I'm getting the following error. This error doesn't happen often, it only occurs occasionally. Could it be because I'm processing too many files, or the file processing is too fast? How can I avoid this? thanks
error: an Illustrator error occurred: 1346458189 ('MRAP')
var bordColor = ['color1', 'color2', 'color3', 'color4'];
checkFrameSpotColor(bordColor);
function checkFrameSpotColor(bordColor) {
var foundBorderColor = false;
var swatchList = doc.swatches;
if (!swatchList || swatchList.length <= 0) {
throw new Error("Unable to obtain color swatches");
}
var currentSwatch;
var currentSwatchName;
var isTargetName;
for (var i = swatchList.length - 1; i >= 0; i--) {
$.sleep(200);
try {
currentSwatch = swatchList[i];
currentSwatchName = currentSwatch.name; // The error point is usually here.
isTargetName = false;
for (var j = 0; j < bordColor.length; j++) {
if (currentSwatchName === bordColor[j]) {
isTargetName = true;
break;
}
}
if (isTargetName) {
if (currentSwatch.color && currentSwatch.color.typename == "SpotColor") {
foundBorderColor = true;
break;
}
}
} catch (e) {
continue;
}
}
if (!foundBorderColor) {
throw new Error("Please confirm if the frame stroke color is a spot color.");
}
}
