#target Illustrator
if (app.documents.length !== 0) {
var res = checkOpacityMask();
alert (res);
}
function checkOpacityMask() {
$.errorMessage = function (err) {alert('Error ' + err.number +': ' + err.message + '\n Line:' + err.line + '\n-> ' + err.source.split("\n")[err.line - 1]);};
var doc = app.activeDocument;
var tempLayer = doc.layers.add();
// Load action ==========================================
var ActionString = [ '/version 3',
'/name [ 9',
' 536372697074536574',
']',
'/isOpen 1',
'/actionCount 1',
'/action-1 {',
' /name [ 2',
' 524d',
' ]',
' /keyIndex 0',
' /colorIndex 0',
' /isOpen 0',
' /eventCount 1',
' /event-1 {',
' /useRulersIn1stQuadrant 0',
' /internalName (ai_plugin_transparency)',
' /localizedName [ 12',
' 5472616e73706172656e6379',
' ]',
' /isOpen 0',
' /isOn 1',
' /hasDialog 0',
' /parameterCount 1',
' /parameter-1 {',
' /key 1919710053',
' /showInPalette -1',
' /type (ustring)',
' /value [ 0',
'',
' ]',
' }',
' }',
'}'].join('\n');
var f = new File('~/ScriptSet.aia');
f.open('w');
f.write(ActionString);
f.close();
loadAction (f);
f.remove();
ActionString = null;
//================================Load action
try {
var pI = [];
for (var i = 0; i < doc.pageItems.length; i++) {
pI[i] = doc.pageItems[i];
}
for (var i = 0; i < pI.length; i++) {
pI[i].duplicate(tempLayer);
}
tempLayer.hasSelectedArtwork = true;
redraw ();
var refCount = doc.selection.length;
app.doScript("RM", "ScriptSet");
unloadAction("ScriptSet", "");
redraw ();
var checkCount = doc.selection.length;
tempLayer.remove();
redraw ();
if (checkCount !== refCount) {
return true;
} else {
return false;
}
} catch (e) {
unloadAction("ScriptSet", "");
tempLayer.remove();
$.errorMessage(e);
}
}