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

How to assign blend mode to a graphic in indesign CS6, javascript

Participant ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

Hi,

I need to set blend mode for artwork to multiply in Indesign CS 6 through Javascript:

myLinkFile = myFrame.place (myFile);

myFile.blendmode = multiply;

But I was not able to find it in Object Model Viewer.

Thank you.

Yulia

TOPICS
Scripting

Views

872

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
Community Expert ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

Hi Yulia,

see into:

Adobe InDesign CS6 (8.0) Object Model JS: TransparencySetting

Climb up in the hierarchy of objects to get to e.g. contentTransparencySettings etc.pp. if needed.

Here an example with transparencySettings :

// Example

// Select an object on the page

var item = app.selection[0];

item.transparencySettings.blendingSettings.properties =

{

    blendMode : BlendMode.MULTIPLY ,

    opacity : 50 ,

    isolateBlending : false ,

    knockoutGroup : false

};

Best download the iChm files to search in DOM documentation by Jongware here:

Indesign JavaScript Help

Regards,
Uwe

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
Participant ,
Jun 20, 2017 Jun 20, 2017

Copy link to clipboard

Copied

Yes, thank you, it did work. I had to remove opacity, but all else is good:

var item = app.selection[0];

item.transparencySettings.blendingSettings.properties =

{

    blendMode : BlendMode.MULTIPLY ,

    isolateBlending : false ,

    knockoutGroup : false

};

Yulia

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
Community Expert ,
Jun 20, 2017 Jun 20, 2017

Copy link to clipboard

Copied

myLinkFile = myFrame.place (myFile);

myFile.blendmode = multiply;

Hi Yulia,

why do you like to set the blendmode to the contents of variable myFile ? Your code is suggesting this.
I guess, there is actually a file object stored with this variable. You cannot set transparency to a file stored in your system.
For that you would like to open it in the creator app and set transparency there.

Instead you would set transparency to a placed "thing" on a page in InDesign that could be anything depending on your file type.
An image, a vector graphic, a PDF etc.pp.

So check what's in variable myLinkFile that is returned by method place() :

$.writeln(myLinkFile);

But be not misguided what you see with that. Also ask:

$.writeln(myLinkFile.constructor.name);

And if that's clear, also do:

$.writeln(myLinkFile.length);

And maybe you want to know:

$.writeln(myLinkFile[0].constructor.name);

And now think about what object you like to set to multiply.


The "thing" inside the frame?

( Could also be outside the frame depending on the file type you are placing even if you do myFrame.place() )

  • myLinkFile[0]

    or the frame, that would be:

    myFrame

    That frame could be also defined as:

    myLinkFile[0].parent

    But it's not sure if myFrame and myLinkFile[0].parent is always the same object.

  • Look up this:

    Adobe InDesign CS6 (8.0) Object Model JS: Rectangle

    Would variable myLinkFile always be of length 1 ?
    Depending on the file type—see into IDMS snippet files—the length could be different.
    E.g. if the IDMS snippet file you want to place contains several ungrouped page items.

  • FWIW: If you do method place() on a graphic frame with an IDMS snippet file the contents will placed on the spread where the graphic frame resides. And not in the frame. No error message…
  • Regards,
    Uwe

    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
    Participant ,
    Jun 22, 2017 Jun 22, 2017

    Copy link to clipboard

    Copied

    LATEST

    Hi Uwe,

    You are absolutely correct. It did not work when I used it on File object, so I tried it on the rectangle object containing the file and it did work.

    Thank you.

    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