Apache OpenOffice (AOO) Bugzilla – Issue 18898
Basic macros not executing on "Open Document"
Last modified: 2004-02-05 07:18:25 UTC
* Create a new Writer document * Create a Basic macro in this document: Sub MyStartDialog msgbox("Hello world") End Sub * Set this macro to automatically run when opening the document with "Tools -> Configuration -> Events", be sure that the radio button "Document" is selected, click on "Open Document" list item and assign the macro below to the event. * Save and close the document * open the document again, you may get the "this document contains macros-add directory to trusted"-alert but the macro itself does not execute. It is reported to work correctly under Solaris, but does not under Linux (in my case Red Hat 9).
Andreas, Don't know if this is framework or basic, any idea?
Usually problems like this are framework issues...
It works for me: if I press "Run", the macro is executed (OOo1.1 RC3, Suse7.3). Thorsten, can you reproduce it on RH9? If not, please close this issue.
just tested on a fresh installed Win2k system using OOo1.1rc3, and the bug is there: The document's macro doesn't execute. I found out, that OO.o tries to execute a macro of the same name in the _application_, not in the document. Maybe that helps finding a solution? I'd like to change the OS to "All", not only Linux.
TM->JSK: Please have a look, thanks !
Retargeted without verification for easier query.
Created attachment 9411 [details] Document with attached macro
Confirmed.
Reassign to tbe Reproduced on RH Severn
Created attachment 9550 [details] document with correct call to macro (on opendoc instead of on openappl as in the other attachment by Joerg Skottke)
cc jsk
The bug document i18844.sxw is buggy in itself. The macro is not configured to "Open Document", but the "Start Application". This event is useless in documents.
TBE->JSK: back to you
Please see the second attachment: i18898.sxw - in this document the macro triggers on the "open document"-event. or better: it doesn't trigger ;-)
Hi Martin, sorry for the incorrect attachment. ;) I'd better verify if i attached it to the correct issue as well 8-) I'll try with the new Bugdoc.
Confirmed. The Macro is not executed. Tested on RH9.0.93 and Win2k Reassigning to MBA
i18898.sxw is also incorrect. The event "Open Document" is bound to a macro "Standard.Module1.Macro1" in the *application* basic, not to a macro in the document basic. If you don't have such a macro, of course you will see nothing. You can see this in the content.xml stream of the packed file. This is not a bug in the code that executes the macros.
That's exactly the behaviour I described on 2003-09-05 04:31 (see comments). It seems that is isn't _possible_ to tell a document that it should execute it's _own_ macros - and not the macros of the application - when opening the document. Now what should we do? A new issue? change again to reopen?
Reopen. Maybe we did not get the real problem right - mba pointed me to a possible other problem which i'm going to check right away.
That would indeed be a problem. Sorry, I misinterpreted your comment that there is a problem in searching the macro, but obviously the problem lies in storing the binding. I will check that.
Created attachment 9653 [details] New bugdoc i18898-3.SXW
mba: you were right. i have made pretty sure that my testmacro is connected to the document only - and it is not executed. So it really seems to be a problem with the bindings.
1. I created a document with OOo1.03 with a macro sub main msgbox ("hallo") end sub 2. I assigned the macro to the event 'Open Document', the radio button "Document" was selected 3. I saved and closed the document and reopened is: the macro was executed. 4. Then I opened this document in OOo1.1rc (1-3): the macro was executed. Then I created a new document in OOo1.1rc and repeated steps 1-3, the macro was not executed. I looked at the content.xml of both versions and saw this different "right version": <script:event script:language="StarBasic" script:event-name="on-load" script:location="document" script:macro-name="Standard.Module1.Main"/> "wrong version": <script:event script:language="StarBasic" script:event-name="on-load" script:location="application" script:macro- name="Standard.Module1.Main"/> I hope that will help to find the bug.
.
Thanks, that was helpful.
*** Issue 21015 has been marked as a duplicate of this issue. ***
Joerg, could you please verify the fix in CWS fwk02pp1.
fixed
verified
closed
*** Issue 17809 has been marked as a duplicate of this issue. ***
I reopen this task to verify the fix on the 680 branch also.
Now reassigning to me until CWS is ready
Skotti, please verify this in the 680 build also
again: fixed
Verified for all combinations (macro in doc/app and connected to Open Document)