If you define the variable at the doc-level (not inside a function), it should be available to all other code later on.
var a = "abc";
I don't need to use global?
And where do I write the Doc level script, in order to let it reun on opening the file?
I am using adobe acrobat 8 3D version.
However it lets me add only functions.
Delete the default code and add your code instead. It doesn't have to be inside a function.