Apache OpenOffice (AOO) Bugzilla – Issue 58527
problem with templates and macros in post-2.0 versions
Last modified: 2006-02-18 15:15:56 UTC
I have a lot of macros besides those included (collected them from well-trained people). Some of them are simple, some more elaborate and have more subroutines. My procedure is that I insert a piece of text into a blank writer doc and start to perform tasks by the macros. All these work fine in OOo1 and OOo2. Most of them have toolbar icons and keyboard shortcuts assigned to and the problem decribed below is independent of how they are launched. In all versions after 2.0 (even in 2.0.1rc1) I can successfully launch just one macro (sometimes this, sometimes that, no matter which one but it may be a long and complicated one as well) or at most two, one after the other, and after that I always get a yellow triangle with an exclamation mark and the following text: "com.sun.star.uno.RuntimeExceptionScriptProtocolHandler::createScriptProvider()," The text is always the same. From then on all my own macros fail. The built in macros work, but my own ones do not. None of them. If I close the document and open a new one, not even the first-launched macro executes. If I exit OOo (quickstarter and all) the first macro will execute again. If I uninstall the newer version and put back the older (2.0) it works fine again. Thank you.
Based on the questions I received in OOo-forum I think it reasonable to add the following clarification to my original post. - Where are your macros ? In "My Macros" or in a document, or both ? All my macros are in C:\Documents and Settings\MyUsername\ApplicationData\OpenOffice.org2\user\basic\standard (Win XP). - do you get the same problem when you [b]create[/b] this very simple macro? [code] Sub myMacro MsgBox("It works") End Sub[/code] Yes. It executes on the first document but when I launch it on the second I get the usual com.sun.star.uno.RuntimeExceptionScriptProtocolHandler::createScriptProvider(), message - Did you install 2.0RC1 over 2.0 or did you delete all 2.0 and install a fresh new 2.0RC1 ? Always do a clean install, i.e. I uninstall first but do not delete the user folder in Application Data. - how did you move your old macros to the new installation? I do not move them, they remain in place since 2.0rc1 installs over 2.0 so it uses the same folder in application Data for user settings. Otherwise I copy the user folder to the newly created folder in Application Data.
The same with 2.0.1rc2.
Hi, could you attach a file with some of your macros which don't work?
Created attachment 32010 [details] doc containing self-made macros
Thanks for your answer. I do attach a doc with lots of macros but it will probably show nothing for you. Why? Because if I put my user folder aside, make an absolutely clean install with a newly created user folder and import my macros they all work on the second etc. documents. However, there is no possibility in OOo2 to import my numerous self-made toolbars and my several self-made menus. (Only the keyboard settings.) So I do have to stick to my original user folder. And I emphasize: everything in it works fine if I uninstall OOo2 and reinstall it. If I uninstall OOo2 and install any OOo2+ version (letting it use the existing user folder)I get the defect described. Therefore I think that some change must have happened in OOo along the route where self-made macros in the Modules of Standard in Basic are implemented. Otherwise there should be a problem with the contents of my user folder even if I uninstall OOo2 and reinstall it. Do macros do not execute on the second document. There is a difference in the message I get depending on how I run them. If from the toolbar icons I assigned to them, the message is what I already stated. If from the menu (Tools>Marcos>Run Macro...) the Message is shorter: com.sun.star.uno.RuntimeException.
the macros I tried run fine in OOo 2.0.1 RC2, no errors or such; so defect not reproducable on Windows XP Pro SP2
Thanks for your test. It seems to turn out that the problem is with non-built-in-templates. I made a new install, involving nothing from the previous ones. If I create a brand new blank template with 2.0.1r2 and a brand new blank witer doc, the doc will open without any fuss either by double clicking or from the quickstarter's document open option. The template, however, always brings up the long message (and does not allow the macros to execute) either way opened. If I ask for a new file from the built-in default template, no problem. Please try if it holds true there. I will attach a doc and a template, both blank.
Created attachment 32030 [details] document blank
Created attachment 32031 [details] template blank
I can confirm that macros in the attached template won't execute, but what do you mean by the "built-in default template". And what's with your macros. Do they run after the clean install?
By "built-in default template" I mean that if I do not set a template of my own as default, just ask for a new writer file then the file which opens is always the same since it is be based on internal sources of the program suite. I can define another default template for myself but I cannot change this one. If I want my macros execute on a text which I placed into a newly opened file (opened by clicking on New or holding down Ctrl+N WITHOUT a personal template set as my personal default) then the macros will execute fine. Again so if I open a formerly created and saved document. But if I open a template (set by myself), put some text in it and run the macros they don't work. Even if I set a blank , newly opened file as my personal default template without any modification. The one I sent you was like that. My macros are never embedded in the files, all of them are in Standard. Thank you for you interest in the matter.
Reassigned to JSK.
Please try to duplicate this. Make a clean install of OOo2 RC4 (or any version after OOo2.0 release), choosing custom, allowing all extras, except mobile. [I even cleared the registry of any remnants of former OOo2 installations.) Open a new writer file from the built-in default template. (By "built-in default template" I mean that if I do not set a template of my own as default, just ask for a new writer file then the file which opens is always the same since it is based on internal sources of the program suite. I can define another default template for myself but I cannot change this one.) Open "Tools>>Organize macros" and in Standard>Module 1 (which is now obviously empty) write or copy this macro: Sub myMacro MsgBox("It works") End Sub Save it. Open again a new file from the built-in default template. Run the macro from Tools>>Run macro. It will execute. Now open again a brand new file from the built-in default template. Save it under any name [e.g.MyOwn] to Application Data>OpenOffice.org2>user>template. From Quickstart>From Template open a new file from MyOwn. Run the macro from Tools>>Run macro. It will not execute. It will give this message: "com.sun.star.uno.RuntimeException" *** First I supposed that it was a problem with my installations. As I have already written: it turned out that the problem is not with macros but with templates. Something seriously bad happened to a part of the program suite connected with templates, and it happened after OOo2.0 was issued. It works fine. No version after that allows macros to execute on a document which was opened from a user- made template
confirmed on Windows XP Pro SP2 with OOo 2.0.1 RC2; follow the steps from reporters last comment
setting regression keyword, as it works with 2.0.0 but not with 2.0.1, following reporters last description
Hi Gaborf, thank you for this thorough analysis of the problem, it's one of the finest bugreports i've seen for quite some time :-) I could easily reproduce the issue, even on Linux. Change Target, OS, Component, Owner
I can confirm the error message "com.sun.star.uno.RuntimeExceptionScriptProtocolHandler::createScriptProvider()" which occurs, when a specific template fires the event "OnNew" (the second time after starting the office). The macro resides in the shared folder and runs fine with 2.0. 2.0 was deinstalled completly. It is one of our most used templates. With 2.0 we are frustrated because of the buggy outline numbering, and now we have to wait until 2.0.3? @jsk, abi: Sorry, but please consider the target milestone. It is not acceptable for this serious regression. Regards Peter
Hi Peter, i'm not 100% sure this is the same issue as your macro is triggered by an event and here the macro is run manually. I leave it to the developer to determine. However, you are absolutely correct that this a regression, i will file another task for this with target 2.0.2.
created automated test: framework\basic\f_basic_usertemplate.bas::tMacroUserTemplate submitted issue #59665# based on last comment by Peter with target 2.0.2.
OK in OOo 2.0 / StarOffice 8
Retarget to 2.0.2
.
Accepted
*** Issue 59047 has been marked as a duplicate of this issue. ***
*** Issue 59665 has been marked as a duplicate of this issue. ***
*** Issue 60015 has been marked as a duplicate of this issue. ***
kai, think this is for you and not Andreas ( who will no doubt be glad ;-) ) I will attach a patch which at least seems to fix it. Problem stems from fact that templates do some foo with storage ( uses temporary storage ) but you only know about that after you get a OnNew event ( or so it seemed to me after debugging it
Created attachment 33553 [details] patch file for fix
type -> patch any chance of turning this around and getting fix upstream quickly
mmmm, it just occurs to me that maybe OnNew is not the best event to use, I guess there is a chance of a race condition between a macro firing on "OnNew" and the storage getting reset on the same event, what do you think? It seems that "OnViewCreated" created works equally well and appears like that will always happen before a OnNew event, attaching patch "...-#2.diff" with that option
Created attachment 33562 [details] new patch version
Noel, thanks for the patch. Meanwhile, Andreas together with the framework guys found another, more straight solution, which we prefer over your patch. But thanks again for taking care. Setting task back to Andreas.
->ab any chance of you identifying the cws that this will appear in?
ab->npower: This task has already be assigned to cws ab23pp2 for a long time. But it wasn't clear to me that you cannot see this in an easy way, because SO internally the bug handling framework automatically provides this information for every task. So in the future I will always also write ma- nually into the task which cws I assign it to.
Fixed
*** Issue 60465 has been marked as a duplicate of this issue. ***
Andreas, >This task has already be assigned to cws ab23pp2 for a long >time. :-) > But it wasn't clear to me that you cannot see this in an easy way, >because SO internally the bug handling framework automatically provides >this information for every task. Yes, I searched unsuccessfully in EIS. There is some option in there to allow your cws to be viewed externally or not ( most likely defaulted to no when using internal EIS ) >So in the future I will always also write ma- >nually into the task which cws I assign it to. That would be great :-) thanks again.
ab->jsk: I've tested the fix according to the description from gaborf Fri Dec 9 16:33:50 -0800 2005 re-open issue and reassign to jsk@openoffice.org
reassign to jsk@openoffice.org
reset resolution to FIXED
Verified by autotest, f_basic_usertemplate.inc has been updated.
it's not fixed in m154
andreschnabel->lars: as mentioned by ab, this is fixed in cws ab23pp2, which is not integrated yet. you may search for cws information in EIS: http://eis.services.openoffice.org/EIS2/servlet/GuestLogon
ok with 2.0.2RC1 -> close