Did you know that you could also use APSO to Organize your Python scripts within LibreOffice?

In 2012, the original code for the “Alternative Python Script Organizer” ( APSO ) was written by Hanya.
Some adjustments to the code were made at that time by @Karolus.
In 2016, Hubert Lambert adapted the original script and made it into an .oxt extension.
The APSO extension is available on the French OpenOffice Forum, with an introduction text in French.

EDIT 2017-06-19 11:27
As of today the APSO extension can also be downloaded from the LibreOffice Extensions repository:
APSO - Alternative Script Organizer for Python ( Thanks Jean-Marc Zambon and @Ratslinger ).
END OF EDIT 2017-06-19 11:27

EDIT 2017-12-21
Added APSO menu screenshots with English menus [APSO_menu_en.png] and [APSO_dialogue_en.png], replacing the original screenshots that showed French menus [APSO_menu.png] and [APSO_dialogue.png].

i tried to translate the original introduction text from Hubert Lambert into English:
( please forgive any errors in the translation that might have occurred, and correct where necessary… )

______________ Start of translation

Managing Scripts in Python
by Hubert Lambert » 09 Nov 2016 17:49

Good day to all,

[To follow up on this thread, and in particular the suggestion by Dude, i post here a part of the original message.]

Hanya, one of the most brilliant and effective contributors of the sections “Macros and API” on the English-language forum, has in 2012 proposed a script ( Alternative Python Script Organizer ) that enormously simplifies the management of Python scripts on OpenOffice or LibreOffice. I think this script deserves a far better visibilty.

To make it easier to use, i have adapted it as follows :

 - French translation of the commands and menu-items ;
 - Added two commands "Embed in document" and "Export" from an existing document ( the code is but a variation of the original code by Hanya ) ;
 - ( Very elementary ) implementation of the option "Edit" through which the script can be modified by the default system editor ;
 - Packaging into an extension to facilitate the installation.

Once this extension is installed ( and the program is restarted just to make sure ), a new menu-item “Organize python scripts…” will appear in the submenu “Macros” of the menu “Tools”.

This new menu-item opens a dialog box listing the scripts and proposing various actions :


The button “Execute” allows you to launch the selected macro.

The available actions from the button “Menu” vary according to the selection, and they are :

 - Create a library or a module if the selection is a container ( "user", "share" or "document" ) ;
 - Edit*, rename, delete a module or a library ;
 - Copy a module from the application ( "user" or "share" ) to the current document ;
 - Replace a module that is embedded in a document by a module that is located on the computer ;
 - Export a module that is embedded in a document.
 [* The option "Edit" only opens the module with the text-editor associated by default to the extension ".py". It doesn't work for scripts that are embedded inside a document.]

This version 0.2, compatible with OpenOffice and LibreOffice, also includes the following elements :

 - internationalization of the extension ( currently French and English ) ;
 - Added a default keyboard shortcut ( Shift + Alt + F11 ) for quick launch ;
 - a mini-library to facilitate development, which contains three functions: xray, mri and msgbox.

To access these from a script, you must have at least once launched the python scripts organizer ( to load the path ) and insert the following line:

from apso_utils import xray, mri, msgbox  

( and Of course installed Xray or MRI if necessary ).

For any suggestion, question or remark, the initial thread given above seems to me the most suitable place.

Added: version 0.3 :
 - addition of German and Italian ;
 - correction of the code.

 Added: version 0.4 :
 - addition of Hungarian ( thanks to Zizi64 ).

 Added: version 0.5 :
 - added an options page that allows you to choose the editor ( based on Hanya's EditorKicker ) ;
 - Opening macros on the corresponding line, if the appropriate option is set ;
 - adapted the vocabulary to be consistent with the default macro manager ( following this thread ) ;
 - better management of errors and accented dialogs. 
 Added: version 0.6 :
 - taken into account the property allowMacroExecution for embedded macros ;
 - subject to providing the editing parameters, possibility of directly accessing the syntax errors from the error message;
 - direct editing of embedded macros ( only in the context of the extension ).

Added: version 0.7 :
- fixed a bug ;
- Implementation of automatic updates.

Added: version 0.8.3 :
- Fixes a problem ( under Windows ) when a path or document contains non-ascii characters.

______________ End of translation

A big “Thank You!” to the author, co-authors, developers, and contributors who made the APSO extension come true!

On this date ( June 19th 2017 ), the current version of the LibreOffice APSO extension is 1.0.0.


@librebel The version on the French site is the same - v0.8.3. It it definitely worth mentioning that APSO provides an easy mechanism to embed Python scripts into documents.

Merci @Ratslinger, i added that last line as a precaution in case a newer version might become available in the future, in case when this thread is not updated with the newest version, and the French site is.
A propos… the APSO functionality should be integrated into LibreOffice.

Very useful. Using it now.

Is it expected that the extension (v.1.1.2) requires Java to run?

APSO, and any future updates, is now available in LO extensions - here.

This is great, i updated the original post to include the new download link, and removed the old link to version 0.8.3.