If a variable is defined at the `top-level' of a macro (that is, not within a subroutine or a function) then its value persists and is available to other macros until the next time the variable is set or HoTMetaL PRO closes (at which time it clears everything and shuts down the script engine).
This provides a certain amount of extra programming flexibility but there are some things you should bear in mind:
Run time errors can occur if a variable that has gone out of scope is referenced. This is particularly true of variables that represent objects (rather than strings or numbers). For example:
<MACRO name="abc" key="" lang="VBScript"> 'SoftQuad Script Language VBScript: MsgBox(doc.IsValid) ' doc set up by some other macro </MACRO>
If the document represented by doc has been closed, a run-time error will occur.
Copyright © SoftQuad Software Inc. 1999