adobe acrobat script

In this tutorial, learn how to code Acrobat JavaScript, including testing and debugging code with the Acrobat JavaScript Console window.
Adobe have integrated a fully fledged scripting language inside Acrobat - Javascript (ECMA Script). This provides document authors, developers and system.
Word 2011 uses VBA, you write the script in a module, you save it in that module. I do not understand how to do this in acrobat X. I have read  PDF Form javascript for making readonly field b. How to Add Watermark Through JavaScript in Acrobat
adobe acrobat script