您当前的位置: 首页 > 

插件开发

暂无认证

  • 2浏览

    0关注

    492博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

illustrator插件--常用功能开发--查找白色叠印--js脚本开发--AI插件

插件开发 发布时间:2022-02-27 11:53:19 ,浏览量:2

  illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是查找白色叠印,开发一个查找白色叠印功能,以下功能仅用于学习交流,请勿用于非法用途和商业用途,源代码如下所示:


checkwhiteoverprint();

function whiteoverprint() {
    for (var k = app.activeDocument.pathItems.length - 1; k > -1; k--) {
        if (app.activeDocument.pathItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.pathItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.pathItems[k].fillColor.cyan == 0 && app.activeDocument.pathItems[k].fillColor.magenta == 0 && app.activeDocument.pathItems[k].fillColor.yellow == 0 && app.activeDocument.pathItems[k].fillColor.black == 0 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                    app.activeDocument.pathItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.cyan == 0 && app.activeDocument.pathItems[k].strokeColor.magenta == 0 && app.activeDocument.pathItems[k].strokeColor.yellow == 0 && app.activeDocument.pathItems[k].strokeColor.black == 0 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                    app.activeDocument.pathItems[k].strokeOverprint = false;
                }
            }
            if (app.activeDocument.pathItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.pathItems[k].fillColor.red == 255 && app.activeDocument.pathItems[k].fillColor.green == 255 && app.activeDocument.pathItems[k].fillColor.blue == 255 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                    app.activeDocument.pathItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.red == 255 && app.activeDocument.pathItems[k].strokeColor.green == 255 && app.activeDocument.pathItems[k].strokeColor.blue == 255 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                    app.activeDocument.pathItems[k].strokeOverprint = false;
                }
            }
            if (app.activeDocument.pathItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.pathItems[k].fillColor.gray == 0 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                    app.activeDocument.pathItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.gray == 0 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                    app.activeDocument.pathItems[k].strokeOverprint = false;
                }
            }
        }
    }
    for (var k = app.activeDocument.compoundPathItems.length - 1; k > -1; k--) {
        if (app.activeDocument.compoundPathItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.compoundPathItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.cyan == 0 && app.activeDocument.compoundPathItems[k].fillColor.magenta == 0 && app.activeDocument.compoundPathItems[k].fillColor.yellow == 0 && app.activeDocument.compoundPathItems[k].fillColor.black == 0 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                    app.activeDocument.compoundPathItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.cyan == 0 && app.activeDocument.compoundPathItems[k].strokeColor.magenta == 0 && app.activeDocument.compoundPathItems[k].strokeColor.yellow == 0 && app.activeDocument.compoundPathItems[k].strokeColor.black == 0 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                    app.activeDocument.compoundPathItems[k].strokeOverprint = false;
                }
            }
            if (app.activeDocument.compoundPathItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.red == 255 && app.activeDocument.compoundPathItems[k].fillColor.green == 255 && app.activeDocument.compoundPathItems[k].fillColor.blue == 255 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                    app.activeDocument.compoundPathItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.red == 255 && app.activeDocument.compoundPathItems[k].strokeColor.green == 255 && app.activeDocument.compoundPathItems[k].strokeColor.blue == 255 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                    app.activeDocument.compoundPathItems[k].strokeOverprint = false;
                }
            }
            if (app.activeDocument.compoundPathItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.gray == 0 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                    app.activeDocument.compoundPathItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[GrayColor]" && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.gray == 0) {
                    app.activeDocument.compoundPathItems[k].selected = true;
                    app.activeDocument.compoundPathItems[k].strokeOverprint = false;
                }
            }
        }
    }
    for (var k = app.activeDocument.groupItems.length - 1; k > -1; k--) {
        if (app.activeDocument.groupItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.groupItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.groupItems[k].fillColor.cyan == 0 && app.activeDocument.groupItems[k].fillColor.magenta == 0 && app.activeDocument.groupItems[k].fillColor.yellow == 0 && app.activeDocument.groupItems[k].fillColor.black == 0 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                    app.activeDocument.groupItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.cyan == 0 && app.activeDocument.groupItems[k].strokeColor.magenta == 0 && app.activeDocument.groupItems[k].strokeColor.yellow == 0 && app.activeDocument.groupItems[k].strokeColor.black == 0 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                    app.activeDocument.groupItems[k].strokeOverprint = false;
                }
            }
            if (app.activeDocument.groupItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.groupItems[k].fillColor.red == 255 && app.activeDocument.groupItems[k].fillColor.green == 255 && app.activeDocument.groupItems[k].fillColor.blue == 255 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                    app.activeDocument.groupItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.red == 255 && app.activeDocument.groupItems[k].strokeColor.green == 255 && app.activeDocument.groupItems[k].strokeColor.blue == 255 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                    app.activeDocument.groupItems[k].strokeOverprint = false;
                }
            }
            if (app.activeDocument.groupItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.groupItems[k].fillColor.gray == 0 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                    app.activeDocument.groupItems[k].fillOverprint = false;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.gray == 0 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                    app.activeDocument.groupItems[k].strokeOverprint = false;
                }
            }
        }
    }
    win.close();
}

function showwhiteoverprint() {
    win.close();
    for (var k = app.activeDocument.pathItems.length - 1; k > -1; k--) {
        if (app.activeDocument.pathItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.pathItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.pathItems[k].fillColor.cyan == 0 && app.activeDocument.pathItems[k].fillColor.magenta == 0 && app.activeDocument.pathItems[k].fillColor.yellow == 0 && app.activeDocument.pathItems[k].fillColor.black == 0 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.cyan == 0 && app.activeDocument.pathItems[k].strokeColor.magenta == 0 && app.activeDocument.pathItems[k].strokeColor.yellow == 0 && app.activeDocument.pathItems[k].strokeColor.black == 0 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                }
            }
            if (app.activeDocument.pathItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.pathItems[k].fillColor.red == 255 && app.activeDocument.pathItems[k].fillColor.green == 255 && app.activeDocument.pathItems[k].fillColor.blue == 255 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.red == 255 && app.activeDocument.pathItems[k].strokeColor.green == 255 && app.activeDocument.pathItems[k].strokeColor.blue == 255 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                }
            }
            if (app.activeDocument.pathItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.pathItems[k].fillColor.gray == 0 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.gray == 0 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    app.activeDocument.pathItems[k].selected = true;
                }
            }
        }
    }
    for (var k = app.activeDocument.compoundPathItems.length - 1; k > -1; k--) {
        if (app.activeDocument.compoundPathItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.compoundPathItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.cyan == 0 && app.activeDocument.compoundPathItems[k].fillColor.magenta == 0 && app.activeDocument.compoundPathItems[k].fillColor.yellow == 0 && app.activeDocument.compoundPathItems[k].fillColor.black == 0 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.cyan == 0 && app.activeDocument.compoundPathItems[k].strokeColor.magenta == 0 && app.activeDocument.compoundPathItems[k].strokeColor.yellow == 0 && app.activeDocument.compoundPathItems[k].strokeColor.black == 0 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                }
            }
            if (app.activeDocument.compoundPathItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.red == 255 && app.activeDocument.compoundPathItems[k].fillColor.green == 255 && app.activeDocument.compoundPathItems[k].fillColor.blue == 255 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.red == 255 && app.activeDocument.compoundPathItems[k].strokeColor.green == 255 && app.activeDocument.compoundPathItems[k].strokeColor.blue == 255 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                }
            }
            if (app.activeDocument.compoundPathItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.gray == 0 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.gray == 0 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    app.activeDocument.compoundPathItems[k].selected = true;
                }
            }
        }
    }
    for (var k = app.activeDocument.groupItems.length - 1; k > -1; k--) {
        if (app.activeDocument.groupItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.groupItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.groupItems[k].fillColor.cyan == 0 && app.activeDocument.groupItems[k].fillColor.magenta == 0 && app.activeDocument.groupItems[k].fillColor.yellow == 0 && app.activeDocument.groupItems[k].fillColor.black == 0 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.cyan == 0 && app.activeDocument.groupItems[k].strokeColor.magenta == 0 && app.activeDocument.groupItems[k].strokeColor.yellow == 0 && app.activeDocument.groupItems[k].strokeColor.black == 0 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                }
            }
            if (app.activeDocument.groupItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.groupItems[k].fillColor.red == 255 && app.activeDocument.groupItems[k].fillColor.green == 255 && app.activeDocument.groupItems[k].fillColor.blue == 255 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.red == 255 && app.activeDocument.groupItems[k].strokeColor.green == 255 && app.activeDocument.groupItems[k].strokeColor.blue == 255 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                }
            }
            if (app.activeDocument.groupItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.groupItems[k].fillColor.gray == 0 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.gray == 0 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    app.activeDocument.groupItems[k].selected = true;
                }
            }
        }
    }
}

function checkwhiteoverprint() {
    var checkwhiteoverprintcountfill = 0;
    var checkwhiteoverprintcountstroke = 0;
    for (var k = app.activeDocument.pathItems.length - 1; k > -1; k--) {
        if (app.activeDocument.pathItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.pathItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.pathItems[k].fillColor.cyan == 0 && app.activeDocument.pathItems[k].fillColor.magenta == 0 && app.activeDocument.pathItems[k].fillColor.yellow == 0 && app.activeDocument.pathItems[k].fillColor.black == 0 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.cyan == 0 && app.activeDocument.pathItems[k].strokeColor.magenta == 0 && app.activeDocument.pathItems[k].strokeColor.yellow == 0 && app.activeDocument.pathItems[k].strokeColor.black == 0 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
            if (app.activeDocument.pathItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.pathItems[k].fillColor.red == 255 && app.activeDocument.pathItems[k].fillColor.green == 255 && app.activeDocument.pathItems[k].fillColor.blue == 255 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.red == 255 && app.activeDocument.pathItems[k].strokeColor.green == 255 && app.activeDocument.pathItems[k].strokeColor.blue == 255 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
            if (app.activeDocument.pathItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.pathItems[k].fillColor.gray == 0 && app.activeDocument.pathItems[k].fillOverprint == true && app.activeDocument.pathItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.pathItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.pathItems[k].strokeColor.gray == 0 && app.activeDocument.pathItems[k].strokeOverprint == true && app.activeDocument.pathItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
        }
    }
    for (var k = app.activeDocument.compoundPathItems.length - 1; k > -1; k--) {
        if (app.activeDocument.compoundPathItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.compoundPathItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.cyan == 0 && app.activeDocument.compoundPathItems[k].fillColor.magenta == 0 && app.activeDocument.compoundPathItems[k].fillColor.yellow == 0 && app.activeDocument.compoundPathItems[k].fillColor.black == 0 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.cyan == 0 && app.activeDocument.compoundPathItems[k].strokeColor.magenta == 0 && app.activeDocument.compoundPathItems[k].strokeColor.yellow == 0 && app.activeDocument.compoundPathItems[k].strokeColor.black == 0 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
            if (app.activeDocument.compoundPathItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.red == 255 && app.activeDocument.compoundPathItems[k].fillColor.green == 255 && app.activeDocument.compoundPathItems[k].fillColor.blue == 255 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.red == 255 && app.activeDocument.compoundPathItems[k].strokeColor.green == 255 && app.activeDocument.compoundPathItems[k].strokeColor.blue == 255 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
            if (app.activeDocument.compoundPathItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.compoundPathItems[k].fillColor.gray == 0 && app.activeDocument.compoundPathItems[k].fillOverprint == true && app.activeDocument.compoundPathItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.compoundPathItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.compoundPathItems[k].strokeColor.gray == 0 && app.activeDocument.compoundPathItems[k].strokeOverprint == true && app.activeDocument.compoundPathItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
        }
    }
    for (var k = app.activeDocument.groupItems.length - 1; k > -1; k--) {
        if (app.activeDocument.groupItems[k].fillColor != "[SpotColor]") {
            if (app.activeDocument.groupItems[k].fillColor == "[CMYKColor]") {
                if (app.activeDocument.groupItems[k].fillColor.cyan == 0 && app.activeDocument.groupItems[k].fillColor.magenta == 0 && app.activeDocument.groupItems[k].fillColor.yellow == 0 && app.activeDocument.groupItems[k].fillColor.black == 0 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[CMYKColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.cyan == 0 && app.activeDocument.groupItems[k].strokeColor.magenta == 0 && app.activeDocument.groupItems[k].strokeColor.yellow == 0 && app.activeDocument.groupItems[k].strokeColor.black == 0 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
            if (app.activeDocument.groupItems[k].fillColor == "[RGBColor]") {
                if (app.activeDocument.groupItems[k].fillColor.red == 255 && app.activeDocument.groupItems[k].fillColor.green == 255 && app.activeDocument.groupItems[k].fillColor.blue == 255 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[RGBColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.red == 255 && app.activeDocument.groupItems[k].strokeColor.green == 255 && app.activeDocument.groupItems[k].strokeColor.blue == 255 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
            if (app.activeDocument.groupItems[k].fillColor == "[GrayColor]") {
                if (app.activeDocument.groupItems[k].fillColor.gray == 0 && app.activeDocument.groupItems[k].fillOverprint == true && app.activeDocument.groupItems[k].fillColor != "[None]") {
                    checkwhiteoverprintcountfill = checkwhiteoverprintcountfill + 1;
                }
            }
            if (app.activeDocument.groupItems[k].strokeColor == "[GrayColor]") {
                if (app.activeDocument.groupItems[k].strokeColor.gray == 0 && app.activeDocument.groupItems[k].strokeOverprint == true && app.activeDocument.groupItems[k].strokeColor != "[None]") {
                    checkwhiteoverprintcountstroke = checkwhiteoverprintcountstroke + 1;
                }
            }
        }
    }
    totallistfill = "填充: " + checkwhiteoverprintcountfill;
    totalliststroke = "描边: " + checkwhiteoverprintcountstroke;
    res = "dialog { \n\t\ttext:'查找白色叠印', \n\t\tproperties:{ closeOnKey:'OSCmnd+W', resizeable:false}, \n\t\t\tallGroups: Panel { orientation:'stack', preferredSize: [250, 20] \n\t\t\ttext: '白色叠印:', \n\t\t\tjobinformation: Group { orientation: 'column', alignment: 'left', \n\t\t\t\t\tcount: Group { orientation: 'row', alignment: 'left', \n\t\t\t\t\tscountfill: StaticText { text:'" + totallistfill + "', alignment: 'left' }, \n\t\t\t\t\tscountstroke: StaticText { text:'" + totalliststroke + "', alignment: 'left' }, \n\t\t\t\t\t} \n\t\t\t}, \n\t\t\t}, \n\t\t\tbuttons: Group { orientation: 'row', alignment: 'center', \n\t\t\tcancelBtn: Button { text:'取消', properties:{name:'cancel'} }, \n\t\t\tshowBtn: Button { text:'显示', properties:{name:'show'} }, \n\t\t\tokBtn: Button { text:'去除白色叠印', properties:{name:'ok'} }, \n\t\t\t} \n\t\t} \n\t}";
    win = new Window(res);
    win.frameLocation = [100, 100];
    win.buttons.okBtn.onClick = function() {
        whiteoverprint();
    };
    win.buttons.showBtn.onClick = function() {
        showwhiteoverprint();
    };
    win.center();
    win.show();
}

  合理的脚本代码可以有效的提高工作效率,减少重复劳动。

文章引用至 作者知了-联系方式1

文章引用至 作者知了-联系方式2

关注
打赏
1665481431
查看更多评论
立即登录/注册

微信扫码登录

0.0404s