You can write a plugin for this.
COSDict, or something else?
What exactly are document level scripts and what are the other levels of the scripts and how to write this plugin ? what doc to read for this ?
Acrobat JavaScrpt is similar to macros within an MS Office document.