Issue 18898 - Basic macros not executing on "Open Document"
Summary: Basic macros not executing on "Open Document"
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: OOo 1.1 RC3
Hardware: PC All
: P3 Trivial with 4 votes (vote)
Target Milestone: OOo 1.1.1
Assignee: joerg.skottke
QA Contact: issues@framework
URL:
Keywords:
: 17809 (view as issue list)
Depends on:
Blocks:
 
Reported: 2003-09-01 17:17 UTC by marrwinn
Modified: 2004-02-05 07:18 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Document with attached macro (6.18 KB, application/octet-stream)
2003-09-17 13:34 UTC, joerg.skottke
no flags Details
document with correct call to macro (on opendoc instead of on openappl as in the other attachment by Joerg Skottke) (6.18 KB, application/octet-stream)
2003-09-21 17:44 UTC, marrwinn
no flags Details
New bugdoc i18898-3.SXW (6.66 KB, application/octet-stream)
2003-09-25 10:13 UTC, joerg.skottke
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description marrwinn 2003-09-01 17:17:13 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).
Comment 1 noel.power 2003-09-02 09:01:13 UTC
Andreas,

Don't know if this is framework or basic, any idea?
Comment 2 ab 2003-09-02 09:33:39 UTC
Usually problems like this are framework issues...
Comment 3 Mathias_Bauer 2003-09-05 10:03:16 UTC
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.
Comment 4 marrwinn 2003-09-05 12:31:35 UTC
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.
Comment 5 thorsten.martens 2003-09-12 15:17:39 UTC
TM->JSK: Please have a look, thanks !
Comment 6 joerg.skottke 2003-09-17 10:22:02 UTC
Retargeted without verification for easier query.
Comment 7 joerg.skottke 2003-09-17 13:34:50 UTC
Created attachment 9411 [details]
Document with attached macro
Comment 8 joerg.skottke 2003-09-17 13:35:47 UTC
Confirmed. 
Comment 9 joerg.skottke 2003-09-17 13:37:01 UTC
Reassign to tbe
Reproduced on RH Severn
Comment 10 marrwinn 2003-09-21 17:44:15 UTC
Created attachment 9550 [details]
document with correct call to macro (on opendoc instead of on openappl as in the other attachment by Joerg Skottke)
Comment 11 joerg.skottke 2003-09-24 09:56:39 UTC
cc jsk
Comment 12 Mathias_Bauer 2003-09-24 10:08:38 UTC
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.
Comment 13 thomas.benisch 2003-09-24 10:15:30 UTC
TBE->JSK: back to you
Comment 14 marrwinn 2003-09-24 10:25:13 UTC
Please see the second attachment: i18898.sxw - in this document the
macro triggers on the "open document"-event. or better: it doesn't
trigger ;-)
Comment 15 joerg.skottke 2003-09-24 10:42:19 UTC
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.
Comment 16 joerg.skottke 2003-09-25 07:15:50 UTC
Confirmed. The Macro is not executed. Tested on RH9.0.93 and Win2k

Reassigning to MBA
Comment 17 Mathias_Bauer 2003-09-25 08:13:59 UTC
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.
Comment 18 marrwinn 2003-09-25 08:55:27 UTC
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?
Comment 19 joerg.skottke 2003-09-25 09:08:47 UTC
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.

Comment 20 Mathias_Bauer 2003-09-25 10:08:14 UTC
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.
Comment 21 joerg.skottke 2003-09-25 10:13:56 UTC
Created attachment 9653 [details]
New bugdoc i18898-3.SXW
Comment 22 joerg.skottke 2003-09-25 10:15:31 UTC
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.
Comment 23 dactylis 2003-09-25 13:59:38 UTC
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.
Comment 24 Mathias_Bauer 2003-09-26 09:57:32 UTC
.
Comment 25 Mathias_Bauer 2003-10-17 17:05:52 UTC
Thanks, that was helpful.
Comment 26 joerg.skottke 2003-10-20 12:29:53 UTC
*** Issue 21015 has been marked as a duplicate of this issue. ***
Comment 27 Mathias_Bauer 2003-10-30 12:26:39 UTC
Joerg, could you please verify the fix in CWS fwk02pp1.
Comment 28 joerg.skottke 2003-10-31 08:47:20 UTC
fixed
Comment 29 joerg.skottke 2003-10-31 08:47:39 UTC
verified
Comment 30 joerg.skottke 2003-12-01 10:33:59 UTC
closed
Comment 31 Mathias_Bauer 2004-01-07 15:19:38 UTC
*** Issue 17809 has been marked as a duplicate of this issue. ***
Comment 32 Mathias_Bauer 2004-01-12 14:25:00 UTC
I reopen this task to verify the fix on the 680 branch also.
Comment 33 Mathias_Bauer 2004-01-12 14:25:59 UTC
Now reassigning to me until CWS is ready
Comment 34 Mathias_Bauer 2004-01-12 16:40:15 UTC
.
Comment 35 Mathias_Bauer 2004-01-28 10:16:17 UTC
Skotti, please verify this in the 680 build also
Comment 36 Mathias_Bauer 2004-01-28 10:19:48 UTC
.
Comment 37 joerg.skottke 2004-01-28 10:34:36 UTC
fixed
Comment 38 joerg.skottke 2004-01-28 10:36:13 UTC
again: fixed
Comment 39 joerg.skottke 2004-01-28 10:36:45 UTC
Verified for all combinations (macro in doc/app and connected to Open Document)
Comment 40 joerg.skottke 2004-02-05 07:18:25 UTC
closed