Sometimes you need to have a script run only when you save or open or even print a document. These are document level scripted events. They aren't available by default, so how do you turn them on?
With the label file you want to script open, go to File > BarTender Document settings. Click the Scripting tab and check the checkbox.
These event functions will now be available in the script editor.