Page 1 of 1

How to open a .xba BASIC file?

Posted: Tue Apr 01, 2008 1:58 am
by acknak
I wanted to study some BASIC code from an extension published as an .oxt archive. So I extracted the BASIC files from the zip archive, as "Foobar.xba", e.g. It's very simple XML, with only a header element around the whole file, which is easy enough to ignore. But of course many of the operators and other punctuation characters are encoded as entities, as with HTML: & which makes the code rather difficult to read.

Is there some way to open such a file in OOo? File > Open in the BASIC editor naturally loads it into Writer as a text file--not very sensible. Do I have to install the extension in order to view the source comfortably?

Open in MSWord fails; Wordpad treats it as plain text. Open in Firefox almost works: it respects the XML header and decodes the entities, but also ignores all the whitespace: goodbye line breaks and indentation.

I must be missing something obvious again.

Re: How to open a .xba BASIC file?

Posted: Tue Apr 01, 2008 2:23 am
by Villeroy
Somewhere I have a Python script with a class "XBAParser" or something.

Code: Select all

$ python parseXBA.py module.xba > module.txt
Mmmh, got to search backup archives.
You could copy the xba to <profile>/user/basic/SomeLib/
and edit <profile>/user/basic/SomeLib/script.xlb to welcome your module as a new lib member:

Code: Select all

 <library:element library:name="Module1"/>

Re: How to open a .xba BASIC file?

Posted: Tue Apr 01, 2008 3:52 am
by acknak
Ok. Well, I guess I didn't miss something obvious then ;-)

I guess this could work too: [XML Filter] Create XSLT filters for import and export, but that still wouldn't load the file into the code editor, right?

Thanks for the suggestions. I think I can get something to work now.

Re: How to open a .xba BASIC file?

Posted: Tue Apr 01, 2008 9:56 pm
by B Marcelly
acknak wrote:I wanted to study some BASIC code from an extension published as an .oxt archive. So I extracted the BASIC files from the zip archive, as "Foobar.xba", e.g.
Hi,
The simplest solution is to install the extension :mrgreen:
Another solution:
- unzip the oxt somewhere.
- this xba file is in a directory. This directory name is a library name.
- use the Basic organizer to import the library. You have to select the dialog.xlb or script.xlb file
- now you have the library in My Macros and Dialogs.

______
Bernard