RichC

I'm just a little cleavage monkey

8.30.2005

Properly scaled drop shadows after scaling a text box in InDesign

Ok, A bit geekier than normal, but this one has been bothering me.
In Indesign, if you have a drop shadow applied to a text frame, and then scale the text frame, the drop shadow does NOT scale as well.
Not a good UI experience. So to compensate, I wrote a two part script that looks at the values applied to a text frame, lets you make your scaling adjustments to the frame, figures out the scaling factor before vs. after and applies it to the text frame.

Problem is, this only works if you run the script before you make your edits. I can't noodle a way around this elegantly since edits are often a n step process.

So here's the script, I hope it helps someone.

property UserInterActionRequired : true

if UserInterActionRequired is true then
tell application "Adobe InDesign CS2"
display dialog "Getting text frame properties.
Run script a second time to make drop shadow proportional to current text size.

If you have already scaled the text frame, cancel here, undo and run this script again"
try
set myObject to object reference of (properties of selection)
tell active document
set char1FontSize to point size of character 1 of word 1 of myObject
set SBR to shadow blur radius of applied object style of myObject
set SBX to shadow x offset of applied object style of myObject
set SBY to shadow y offset of applied object style of myObject
end tell
on error
display dialog "Please select text frame prior to running script."
end try
end tell
set UserInterActionRequired to false
else
tell application "Adobe InDesign CS2"
display dialog "Factoring differences between text frame before scaling and after.

If you haven't already scaled the text frame, cancel here, and run this script again"
tell active document
set char1FontSize2 to point size of character 1 of word 1 of myObject
set myScaleFactor to (char1FontSize2 / char1FontSize)
set shadow blur radius of applied object style of myObject to (SBR * myScaleFactor)
set shadow x offset of applied object style of myObject to (SBX * myScaleFactor)
set shadow y offset of applied object style of myObject to (SBY * myScaleFactor)
end tell
end tell
display dialog "Click Ok once scaling is complete" default answer "" buttons {"OK"} default button "OK"
set UserInterActionRequired to true
end if