Hi, All. I have a python macro, embended into my .ods file
My macro works well, when I start it manualy throught APSO/standard interfaces
Now I want to autorun it on document open. But on open doc I see an error
Hallo
change the signature of your »run« -function:
def run( *_ ):
…
Great, it works
anyway … on development of event-driven things in context of python you should start with NOT embedded scripts, and some »prototyp«-function for Example:
ctx = XSCRIPTCONTEXT.getComponentContext()
createUnoService = ctx.ServiceManager.createInstance
mri = createUnoService("mytools.Mri")
def _inspect_(event):
mri.inspect(event)
in most cases you may use »event.Source.…« for doing stuff?
Embedding the script into documents and rebind of event, should be the very last step after some development-test-cycles
mri you mean MRI - UNO Object Inspection Tool | Apache OpenOffice Extensions? Have not tried it yet.
Embending+python is awersome), I need not pass scripts to users who work with, and it’s apeared very simple, it is real advantage from MS Office
My suggestions were NOT intended to be passed on to end users later, but were initially only meant to help YOU as developer to inspect the object in “event” and then derive your own function from it.
In the finished script, you will of course no longer need “mri.inspect(…)”.