How to open a .xba BASIC file?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

How to open a .xba BASIC file?

Post 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.
AOO4/LO5 • Linux • Fedora 23
User avatar
Villeroy
Volunteer
Posts: 31344
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to open a .xba BASIC file?

Post 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"/>
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: How to open a .xba BASIC file?

Post 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.
AOO4/LO5 • Linux • Fedora 23
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: How to open a .xba BASIC file?

Post 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
Post Reply