InDesign
Automation
Scripting
Scripting in InDesign
Scripts panel and Script Label panel overview
Enable scripts attached to menus
This page on the Web