| View previous topic :: View next topic |
| Author |
Message |
Mas General User

Joined: 25 Nov 2005 Posts: 9
|
Posted: Tue Dec 06, 2005 6:48 am Post subject: Writing a macro - how to integrate |
|
|
I hope this is a simple question.
I have written a macro in a texteditor. The Macro works as it should when I Copy and Paste it into the editor in OO.
The problem is that I have to add it manually without starting OO.
I thought I have to do the following:
1. Save the Macro to %userpath%\OpenOffice.org2\user\basic\xyz\xyz.xba
2. Make sure that in the script-Tag the name is set correctly.
3. Add the following line to script.xlb (in directory xyz): <library:element library:name="xyz"/>
4. Make sure that the library-name is the same as the directory.
5. Doing the same for dialog.xlb.
6. Add the following line to the script.xlb 1 directory-level higher: <library:library library:name="xyz" xlink:href="$(USER)/basic/xyz/script.xlb/" xlink:type="simple" library:link="false"/>
7. Doing the same for dialog.xlb on the same directory-level.
I thought that should be all I have to do but OO doesn't recognize the new macro. What am I doing wrong? Thank you for help!
A little hint: I just tested the simply version of the problem above: I added the following lines to an existing .xba file in a texteditor:
sub myTest
rem test
End Sub
Then I started OOwriter but it doesn't recognizes the new macro. I think this should be the same problem and I hope that it helps. |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Tue Dec 06, 2005 8:31 am Post subject: |
|
|
| Quote: | | The problem is that I have to add it manually without starting OO. |
I don't understand why you have such a requirement. What you intend to do is very dangerous (for the integrity of your OOo) and implementation-dependent.
Do you know what is an add-on and what you can do with it ? |
|
| Back to top |
|
 |
Torolf General User

Joined: 11 Nov 2005 Posts: 41
|
Posted: Tue Dec 06, 2005 3:45 pm Post subject: |
|
|
B Marcelly,
I know what you mean about using the Addon specs, which is fine for distributing custom code. But I have been thinking of something along the same lines as Mas, and here is why.
I like OOo but hate the Basic Edtitor. I would think about hacking into it, but as it turns out you can't get a handle to the editor, or at least so I am tod by some of the OO developers. The next idea would be to use an outside editor and build a utility that would move the code into the OO configuration. Again, one can not drop any kind of text into an editor window. I suppose that I could do this, under windows anyway, by sending actual windows messages, but that seems rather awkward..or a 50 dollar solution for a 5 dollar problem.
So, the only option is something simliar to what Mas is trying to do. It seems like it sould be straight forward enough, these are only text files..XML if I am not mistaken.
I have not started actively working this idea, but was planning on seeing if there is knowledge as to what the layout is and what entrys are needed in which files.
Could a guy break his configuration this way...yeah I suppose so, but that hardly seems like a reason to not do it, just to be sure there is a good reason to do it.
Torolf,
ps... You are most lkely getting tired of hearing this...but the Xray Util...Thanks very much, cuoldn't live without it. |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Tue Dec 06, 2005 11:47 pm Post subject: |
|
|
Hi Torolf,
I don't know about Mas and Google does not help on such a name.
| Quote: | | I like OOo but hate the Basic Editor. |
Basic Editor is certainly not the best, but still perfectly usable. Also the IDE gives you some debugging facilities and anyway you end up in this editor window when there is something wrong.
| Quote: | | one can not drop any kind of text into an editor window |
Manually, it's easy. You may copy/paste into the editor window with the clipboard. You may also insert a full xxx.bas file into a module at the cursor position. This is certainly a simpler and quicker way than :
- halting OOo
- modifying xml files
- restarting OOo
_______
Bernard |
|
| Back to top |
|
 |
Laurent Godard General User


Joined: 16 Mar 2003 Posts: 47 Location: Grenoble (France)
|
Posted: Wed Dec 07, 2005 12:44 am Post subject: |
|
|
Hi
Look at dynamic macro writting (eg. see Xray 5.1)
then a small dialog, asking for the .bas (text file), the library and module name
should be straightforward and generic (who said easy ?)
Laurent |
|
| Back to top |
|
 |
JZA OOo Advocate


Joined: 01 Feb 2003 Posts: 432 Location: Mexico
|
Posted: Wed Dec 07, 2005 5:33 am Post subject: |
|
|
| B Marcelly wrote: | Hi Torolf,
I don't know about Mas and Google does not help on such a name.
|
MAS is the nick of the guy you answer the original question. About the editor, isnīt it simpler to just create one from scratch. is not very hard, you already have javadoc from the reference. Generating a bindgint to this IDL reference and copy some readline mdule to make the autocomplete is not hard at all. There are many editors that already do that, maybe is just a matter of integrating the IDL reference like PyXray does.
PyXray already parse the documentation, if you add readline you might have some auto-complete functionality. A color coding might be achieve easily if you use something like Kate in KDE or even Screem in Gnome.
Final question, canīt you just use the package manager? I am sure if we make an XML-RPC connected to a repository we can even get some webservice on getting the latest repositories. On a similar way Quanta looks for plugins. _________________ Alexandro Colorado
PPMC Apache OpenOffice
http://es.openoffice.org |
|
| Back to top |
|
 |
Mas General User

Joined: 25 Nov 2005 Posts: 9
|
Posted: Wed Dec 07, 2005 6:03 am Post subject: |
|
|
It's not the editor in OO why I don't want to integrate the macro this way. The described problem is part of a much bigger project and to realize it I have to have a usable macro without starting OO. The simplified structure is as following:
1. Install our application.
2. Open an OO-document over the command-line with the option of a macro (swriter.exe %document% macro:///%macro%).
I hope it's a bit clearer why I ask this question. |
|
| Back to top |
|
 |
Torolf General User

Joined: 11 Nov 2005 Posts: 41
|
Posted: Wed Dec 07, 2005 6:59 am Post subject: |
|
|
Laurent | Quote: | Look at dynamic macro witting (eg. see Xray 5.1)
then a small dialog, asking for the .bas (text file), the library and module name
should be straightforward and generic (who said easy ?) |
Thanks, that sounds like a good place to start. So, would you say it is easy?
JZA | Quote: | | About the editor, isnīt it simpler to just create one from scratch |
B Marcelly | Quote: | | Manually, it's easy. |
Thanks also, but that really isn't the point is it. I know I can cut and past, it is run on GUI windowed systems after all.
But - no code completion?
No concept of templates for generating a standard application framework?
Highlight a block of code and comment it out, or vise versa?
The list could extend...
Then there is the really odd stuff...say I am adding a control to a form and I want to assign some event to a macro...I open the control's property manager, go to the events page..and...oh never mind...I forgot..can't do it this way..must have the place you want to go to created first...sounds right, but in many other environments that is not necessary..I can just double click the blank property and be taken to the macro edtor, with a new sub (procedure or function) header all setup up for me. That would be nice to have, IMO.
So, I can live with this, aks the Sun developers to update it ( but that won't happen, because right now all they can seem to think about is MSO compatibility [nor am I saying that is altogether a bad thing] ), work with the 6 millions lines of c++ code and replace (or update) the editor myself, or try to move basic lines of text into the execution environment pro grammatically. I think the last choice is the path to look at first. (it doesn't help with my event assignment example of course)
There is another idea - The source is available, and instead of a massive update, perhaps one could make the thisComponent recognize the editor window also, then one should be able to write addons for it also .(not sure I am making my point clearly there). However, I read another post here in the forum, or on one of the OOo mailing lists (unfortunately I can't seem to find it again...I suppose I am a poor search criteria writer) that made it sound very much as if this would be a tough road to go.
Mas, sorry I did not mean to hijack the thread.
I will try to ask my questions in their own thread next time.
Torolf |
|
| Back to top |
|
 |
Mas General User

Joined: 25 Nov 2005 Posts: 9
|
Posted: Thu Dec 08, 2005 2:56 am Post subject: |
|
|
I still haven't a solution for the simple problem. I tracked which files are changed when I save a new macro written in OO but there are only the files listed I talked about in my first post.
I repeat my simple question in other words. The Use-Case:
1. Somebody with an installed OO installs my application. The installer copies some files and a new macro to his harddisk.
2. The user opens an OO-document over the command-line with the use of the option macro://... The used macro is the new one.
How do I solve this problem?
I can't believe that it isn't possible. |
|
| Back to top |
|
 |
Mas General User

Joined: 25 Nov 2005 Posts: 9
|
Posted: Thu Dec 08, 2005 3:16 am Post subject: |
|
|
| OK, I solved the problem. I have to restart the computer. Then OO accept the new macro. The topic can be closed. |
|
| Back to top |
|
 |
Laurent Godard General User


Joined: 16 Mar 2003 Posts: 47 Location: Grenoble (France)
|
Posted: Thu Dec 08, 2005 3:27 am Post subject: |
|
|
hi
how did you solve your problem ?
i would say use an addon and unopkg for registration
yes, OOo has to be restarted
Laurent |
|
| Back to top |
|
 |
Mas General User

Joined: 25 Nov 2005 Posts: 9
|
Posted: Thu Dec 08, 2005 9:51 am Post subject: |
|
|
| The solution was the simply restart of the computer. Normally it's the first thing I try but this time... |
|
| Back to top |
|
 |
|