• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Enable Knockout Group

Enthusiast ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Hi All,

Is it possible to apply knockout group for Textframe contents(ie., XXXXX) through scripting?

knockout.png

Succeed by applying knockout for Stroke or PageItems.

//Point 4: Disable overprint for all white text.

var items = app.activeDocument.pageItems;

var myCheck1 = 0;

for (i = 0; i < items.length; i++) {

    if (items.typename == 'PathItem') {

        //fill color

        if (items.fillColor.cyan == 0 && items.fillColor.magenta == 0 && items.fillColor.yellow == 0 && items.fillColor.black == 0)

                items.artworkKnockout = KnockoutState.ENABLED;

        else if (items.fillColor == "[GrayColor]")

            if (items.fillColor.gray == 0)

                  items.artworkKnockout = KnockoutState.ENABLED;

        //stroke color

        if (items.strokeColor.cyan == 0 && items.strokeColor.magenta == 0 && items.strokeColor.yellow == 0 && items.strokeColor.black == 0)

              items.artworkKnockout = KnockoutState.ENABLED;

        else if (items.strokeColor == "[GrayColor]")

            if (items.fillColor.gray == 0)

                   items.artworkKnockout = KnockoutState.ENABLED;

    }

    if(items.typename == 'TextFrame'){   

        for ( var j = 0; j < items.textRanges.length; j++ ) {     

            if (items.textRanges.fillColor.cyan == 0 && items.textRanges.fillColor.magenta == 0 && items.textRanges.fillColor.yellow == 0 && items.textRanges.fillColor.black == 100){   

               

                items.textRanges.artworkKnockout = KnockoutState.ENABLED;   //ERROR or NEED THIS LINE

               

                }}}

                  

}

Regards

Siraj

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Dec 08, 2017 Dec 08, 2017

Hi, BEGINNER_X.

I also couldn't find the property "artworkKnockout" in a TextRange. So I tried using the action.

Silly-V 's great post:

Creating a dynamic action to use with app.doScript() method.

How is this?

var textFrames = app.activeDocument.textFrames,

    actStr = [

        "/version 3",

        "/name [ 15",

        "53616d706c65416374696f6e536574",

        "]",

        "/isOpen 1",

        "/actionCount 1",

        "/action-1 {",

        "/name [ 12",

        "53616d706c65416374696f6e",

        "]",

   

...

Votes

Translate

Translate
Adobe
Contributor ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Hi, BEGINNER_X.

I also couldn't find the property "artworkKnockout" in a TextRange. So I tried using the action.

Silly-V 's great post:

Creating a dynamic action to use with app.doScript() method.

How is this?

var textFrames = app.activeDocument.textFrames,

    actStr = [

        "/version 3",

        "/name [ 15",

        "53616d706c65416374696f6e536574",

        "]",

        "/isOpen 1",

        "/actionCount 1",

        "/action-1 {",

        "/name [ 12",

        "53616d706c65416374696f6e",

        "]",

        "/keyIndex 0",

        "/colorIndex 0",

        "/isOpen 1",

        "/eventCount 1",

        "/event-1 {",

        "/useRulersIn1stQuadrant 0",

        "/internalName (ai_plugin_transparency)",

        "/localizedName [ 12",

        "5472616e73706172656e6379",

        "]",

        "/isOpen 1",

        "/isOn 1",

        "/hasDialog 0",

        "/parameterCount 1",

        "/parameter-1 {",

        "/key 1802399587",

        "/showInPalette 4294967295",

        "/type (enumerated)",

        "/name [ 3",

        "596573",

        "]",

        "/value 1",

        "}",

        "}",

        "}"

    ].join("\n"),

    actFile = File(Folder.desktop + "/SampleActionSet.aia"),

    i,

    max;

try {

    actFile.open("w");

    actFile.write(actStr);

} catch (e) {

    alert("Sorry. The file could not be written.");

} finally {

    actFile.close();

}

app.loadAction(actFile);

actFile.remove();

for (i = 0, max = textFrames.length; i < max; i += 1) {

    textFrames.textRange.select();

    app.doScript("SampleAction", "SampleActionSet");

}

app.unloadAction("SampleActionSet", "");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

LATEST

Another thing I was not aware of! Per-character knockout group options. Can I ask, what visual effect this will produce for you? I can't envision right now how it would work as my experience with knockout group options is only using it on group items to have one of the group's shapes create a transparent area cut out of the shape behind it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines