Script Initialization Demonstration:
I thought it might not harm if I supply a short demo script, which covers general aspects of what happens when DO loads and initializes a script.
It is especially about how you can access Script.config items from global scope, to pre-initialize global objects for later reuse in remaining script events, commands and column functions.
Script.config items are miraculously configurable by the user from the config section of a script. Being able to access those at an early stage is an advantage when it comes to creating userfriendly addins and any attempt to keep the code clean.
I did not see this little trick here yet. Basically this is nothing more than a catch/try around “Script”. In case it is old hat, it surely still helps any beginner to understand the initialization process any better, while an advanced user might be motivated to create the next wonderful dopus extension. o)
The source and some extended comments:
The console output:
Notice the two different appearing blocks and messages printed.
The first block tells things about script loading and initialization, while the second shows a fully initialized script at work.
Event.ScriptInitializationDemo.js.txt (2.78 KB)