Copy link to clipboard
Copied
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.
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;
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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?