Hello, I did lots of search but couldn't find steps to create a python macro for a linux system.
Under the Libreoffice-Tools-macro menu I find :
1. run macro
I can run "Hello world" python macro just fine but can't create one.
2. edit macro
I can only find many macros written only in Basic language. If I try to write my python macro start with "import uno" in it I get syntax error.
3. manage macro
All the 'create', 'edit" buttons are grayed out.
So, where do I create my own python macro? Thanks.
[Solved] Can't find place to create a python macro
[Solved] Can't find place to create a python macro
Last edited by jason1984 on Wed Dec 12, 2018 6:31 pm, edited 2 times in total.
Libreoffice 6.1.3.2 on openSUSE Leap 15.1
Re: Can't find place to create a python macro
You can write Python macros with your favorite text editor and save them in the folder
/home/username/.openoffice/4/user/Scripts/python
using the .py file name extension. They will then appear in the MyMacros section of the OpenOffice macro organizer.
/home/username/.openoffice/4/user/Scripts/python
using the .py file name extension. They will then appear in the MyMacros section of the OpenOffice macro organizer.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Can't find place to create a python macro
With LibreOffice the script path might be ~/.config/libreoffice/4/user/Scripts/python/
Have a look at Tools>Options>Paths
The default paths for templates, galery etc. indicates the profile folder.
See also: https://extensions.libreoffice.org/exte ... thon/1-0.0
Have a look at Tools>Options>Paths
The default paths for templates, galery etc. indicates the profile folder.
See also: https://extensions.libreoffice.org/exte ... thon/1-0.0
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Can't find place to create a python macro
Thank you for helping.
Under my user folder it is:
There's no ./Scripts/Python there. Manually creating one won't make it appear in Macros.
On the other hand, I notice that in Libreoffice-Tools-Options-Path, I have
Classification pointing to /usr/lib64/libreoffice/program/../share/classification/example.xml,
which led me to find /usr/lib64/libreoffice/share/Scripts/Python.
It seems I somehow need to let Libreoffice be aware of python scripts under my home folder so I don't always need root privilege to create a python script in /usr/....Python?
Under my user folder it is:
Code: Select all
~/.config/libreoffice/4/user> ls
autocorr autotext backup basic config database extensions gallery pack psprint registrymodifications.xcu store uno_packages wordbook
On the other hand, I notice that in Libreoffice-Tools-Options-Path, I have
Classification pointing to /usr/lib64/libreoffice/program/../share/classification/example.xml,
which led me to find /usr/lib64/libreoffice/share/Scripts/Python.
It seems I somehow need to let Libreoffice be aware of python scripts under my home folder so I don't always need root privilege to create a python script in /usr/....Python?
Libreoffice 6.1.3.2 on openSUSE Leap 15.1
Re: Can't find place to create a python macro
See Spell checker "red wriggly lines" - beta test fix for AOO for detailed instructions on how to install a python macro.
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can't find place to create a python macro
download/file.php?id=36285 is an example macro distributed as a Writer document with an installer written in Basic. The path and file name is stored in a user field.
The attached template lets you create such an installer. Open the template, double-click the user field, modify the field value, replace the place holder with your source code and save the document in a trusted directory where document macros are allowed to be run (Tools>Options>Security>MacroSecurity>Trusted Sources).
The macro appends the user field value to the profile path, creates the directory if needed and saves the document as plain text which saves the plain text body without the frame and button.
The attached template lets you create such an installer. Open the template, double-click the user field, modify the field value, replace the place holder with your source code and save the document in a trusted directory where document macros are allowed to be run (Tools>Options>Security>MacroSecurity>Trusted Sources).
The macro appends the user field value to the profile path, creates the directory if needed and saves the document as plain text which saves the plain text body without the frame and button.
- Attachments
-
- ScriptInstaller.ott
- Writer template with user field to save plain text files in the user profile (e.g. macros in languages other than StarBasic)
- (18.08 KiB) Downloaded 249 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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved]Can't find place to create a python macro
The problem seems to be needing ..../Scripts/python instead of "Python".
Libreoffice 6.1.3.2 on openSUSE Leap 15.1