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

How can i disable object style "transparencySettings" by script?

Participant ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

tldr: 
Is there a way to create / change an object style in a way that individual transparencySettings are disabled (as shown for the first two settings in this screenshot?

image.png

 

 

 

 

long story:

I have a script, that looks for specific object styles and sets them to non-printing. 
In some older documents, no object styles are applied.  

 

So I need to apply an style to already styled objects. This style must not alter the manually applied style.

This is easyly done by manually creating an object style with every single option disabled. 

 

To make it even simpler, I want to create this style by script. 
I had no problem disabeling every option but transparencySettings with something like that: 

app.documents[0].objectStyles.itemByName('my_style').enableStroke = false;

 

Now my style looks like that:

image.png

 

Unfortunately, I cant find anything like "enableTransparencySettings" or "transparencySettings.enableDropShadowSettings". 
Is there even a way to disable these settings by script?

TOPICS
Scripting

Views

282

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

Community Expert , May 11, 2023 May 11, 2023

It's quite a mouthful:

 

app.documents[0].objectStyles.item ('__ausblenden__')
  .objectEffectsEnablingSettings
  .enableDropShadow = false;

 

P.

Votes

Translate

Translate
Community Expert ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

It's quite a mouthful:

 

app.documents[0].objectStyles.item ('__ausblenden__')
  .objectEffectsEnablingSettings
  .enableDropShadow = false;

 

P.

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 ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

LATEST

@Peter Kahrel Now it works as a charm. Thanks a lot!

 

In case anybody has similar needs, here is my full code: 

#targetengine "session";

app.documents[0].objectStyles.add({
    name: "my_obj_style",

    // Basic options
    enableFill: false,
    enableStroke: false,
    enableStrokeAndCornerOptions: false,
    enableTransformAttributes: false,
    enableParagraphStyle: false,
    enableTextFrameGeneralOptions: false,
    enableTextFrameColumnRuleOptions: false,
    enableTextFrameBaselineOptions: false,
    enableTextFrameAutoSizingOptions: false,
    enableTextFrameFootnoteOptions: false,
    enableStoryOptions: false,
    enableTextWrapAndOthers: false,
    enableAnchoredObjectOptions: false,
    enableFrameFittingOptions: false,
    enableExportTagging: false,

    // Effects
    contentEffectsEnablingSettings: {
        enableDropShadow: false,
        enableBevelEmboss: false,
        enableDirectionalFeather: false,
        enableDropShadow: false,
        enableFeather: false,
        enableGradientFeather: false,
        enableInnerGlow: false,
        enableInnerShadow: false,
        enableOuterGlow: false,
        enableSatin: false,
        enableTransparency: false
    },
    fillEffectsEnablingSettings: {
        enableDropShadow: false,
        enableBevelEmboss: false,
        enableDirectionalFeather: false,
        enableDropShadow: false,
        enableFeather: false,
        enableGradientFeather: false,
        enableInnerGlow: false,
        enableInnerShadow: false,
        enableOuterGlow: false,
        enableSatin: false,
        enableTransparency: false
    },
    objectEffectsEnablingSettings: {
        enableDropShadow: false,
        enableBevelEmboss: false,
        enableDirectionalFeather: false,
        enableDropShadow: false,
        enableFeather: false,
        enableGradientFeather: false,
        enableInnerGlow: false,
        enableInnerShadow: false,
        enableOuterGlow: false,
        enableSatin: false,
        enableTransparency: false
    },
    strokeEffectsEnablingSettings: {
        enableDropShadow: false,
        enableBevelEmboss: false,
        enableDirectionalFeather: false,
        enableDropShadow: false,
        enableFeather: false,
        enableGradientFeather: false,
        enableInnerGlow: false,
        enableInnerShadow: false,
        enableOuterGlow: false,
        enableSatin: false,
        enableTransparency: false
    },

    // Export options
    enableObjectExportAltTextOptions: false,
    enableObjectExportTaggedPdfOptions: false,
    enableObjectExportEpubOptions: false
});

 

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