Skip to main content
Known Participant
October 4, 2022
Answered

InDesign VBScript to apply Drop Shadows

  • October 4, 2022
  • 2 replies
  • 377 views

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.

    This topic has been closed for replies.
    Correct answer rob day

    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;

     

    2 replies

    rob day
    Community Expert
    rob dayCommunity ExpertCorrect answer
    Community Expert
    October 4, 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;

     

    Known Participant
    October 5, 2022

    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?

    Peru Bob
    Community Expert
    Community Expert
    October 4, 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.