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

InDesign VBScript to apply Drop Shadows

Explorer ,
Oct 04, 2022 Oct 04, 2022

Does anyone know how to write an InDesign VBScript to apply Drop Shadows?

I have tried various things, such as:

 

with myParagraphStyle
              .appliedfont = TitlePageFont
              .TransparencySetting.DropShadowSettings.Mode = Drop
end With

 

and:


myTextFrame.ParentStory.Texts.Item(1).ContentTransparencySetting.DropShadowSettings.Mode = Drop

 

and many variants on these - all without success.

 

I just can't seem to get the object model right.

 

Any suggestions would be gratefully appreciated.

275
Translate
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 , Oct 04, 2022 Oct 04, 2022

Hi @chrisnaylor , I can‘t help you with VB, but with JavaScript you don’t apply the drop shadow affect directly to a text object, it’s applied to a page item or text frame like this where the selection is a text frame and the drop shadow is applied to the contentTransparency (the text):

 

//a selected text frame
var s = app.activeDocument.selection[0];
//apply a dropshadow to the frame’s text content
s.contentTransparencySettings.dropShadowSettings.mode = ShadowMode.DROP;

 

Translate
Community Expert ,
Oct 04, 2022 Oct 04, 2022

I've moved this from the Using the Community forum (which is the forum for issues using the forums) to the InDesign forum so that proper help can be offered.

Translate
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 ,
Oct 04, 2022 Oct 04, 2022

Hi @chrisnaylor , I can‘t help you with VB, but with JavaScript you don’t apply the drop shadow affect directly to a text object, it’s applied to a page item or text frame like this where the selection is a text frame and the drop shadow is applied to the contentTransparency (the text):

 

//a selected text frame
var s = app.activeDocument.selection[0];
//apply a dropshadow to the frame’s text content
s.contentTransparencySettings.dropShadowSettings.mode = ShadowMode.DROP;

 

Translate
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
Explorer ,
Oct 05, 2022 Oct 05, 2022
LATEST

Many thanks for your posting - that was brilliant!

 

You have solved the problem.

 

For the record, the VBScript I used now looks like this:

 

rem Add Drop Shadow:
myTextFrame.ContentTransparencySettings.DropShadowSettings.Mode = idShadowMode.idDrop

 

That works fine  although it looks as if it isn't readily possible to apply the drop shadow selectively to items within the text frame, it seems to apply to all items in the text frame or none of them. Unless, of course, I'm missing something?

Translate
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