Two Great Books for Automating InDesign
For InDesign CS4 (and beyond)
Although later versions of InDesign have added some awesome capability, most of the core functionality is still the same. Get familiar with ExtendScript, Adobe’s cross-platform scripting language. Use and modify scripts provided, and learn how easy it is to take advantage of the hidden power of Adobe InDesign. Scripts for book are also available for InDesign CS6.

