[Solved] Where to put my (python) macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
barak1969
Posts: 4
Joined: Sat Jul 28, 2018 9:15 pm

[Solved] Where to put my (python) macro

Post by barak1969 »

i have tried to put in %USERPROFILE%/Scripts/python but it does not shown in macros selector.
what im doing wrong?
Last edited by barak1969 on Sun Jul 29, 2018 3:23 pm, edited 1 time in total.
openoffice 4.1.5 on windows10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: where to put my (python) macro

Post by Villeroy »

%USERPROFILE% is not a Windows variable, but %APPDATA% is.
Enter %APPDATA% into the file explorer's address line and you land in a directory where several programs save settings in files.
%APPDATA%\OpenOffice\4\user\ is the profile folder of OpenOffice4. It stores all registered templates, macros, auto-text, dictionaries, settings and stuff that is not stored in the installation directory and that are not stored within a document.
In that profile folder you find Scripts which may be empty. For every non-Basic language you have to create a directory. So create a new directory "python" and store your source code in that directory.
I use to use further subdirectorys like ...\Scripts\python\pyCalc\ for Calc macros, pyDBA for database access macros and pyWriter for Writer macros. The py prefix makes my Python macros distinguishable from similar Basic macros in the macro picker dialogs.
You may be interested in https://extensions.libreoffice.org/exte ... for-python which works with Openoffice as well.
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
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: where to put my (python) macro

Post by Villeroy »

You may also be interested in my quick and dirty script installer. It is a little Basic macro because I already had most of the Basic code at hand. The Basic code is embedded in a Writer template.

Open the template for a new installer document.
Replace the placeholder field with your code or with any other text you want to store in the user profile.
Double-click the variable field in the frame above the code and enter the path-name of your file relatively to the user profile.
Save the new document as Open Document Text (*.odt).
Attachments
Script_Installer.ott
Simple Writer template with Basic macro saving the document's text to some text file. Replace placeholder, double-click and edit the user variable.
(16.82 KiB) Downloaded 167 times
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
Post Reply