Hello. I’am testing work with global variables, which I can use across Python macros.
I’ve found the script, but it does’t work, I think there is wrong methods name (maybe old version)
def _set_global_var(doc, name, value):
props = doc.getDocumentProperties().getUserDefinedProperties()
props.setPropertyValue(name, value)
def _get_global_var(doc, name, default=None):
props = doc.getDocumentProperties().getUserDefinedProperties()
return props.getPropertyValue(name)
def run(*_):
calc_doc = XSCRIPTCONTEXT.getDocument()
_set_global_var(calc_doc, 'param1', 'value1')