Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Paul, I sent you an example off-list.  The easiest way I've been able
to get this to work is by embedding the script into the ODS or ODT
file itself.  Try this: unzip an ODS file.  Create a directory called
Scripts, and then a directory called python under Scripts.  (Note the
capitalization!)  Put your Python script in the Scripts/python
directory.  Next, edit the manifest.xml file under META-INF and add a
section containing the text shown below, in the place shown below.
Finally, zip it all back up and open it with Calc.  You should be able
to run your macro now, if your security is set properly.

This is probably not what you want to do, if your script will need to
touch lots of different ODT/ODS files.  The file I sent contains a
macro that is intended to run only on that file.

(The file in question is a budget spreadsheet; the Python macro
calculates all of your pay weeks and adds a sheet to the workbook for
each pay week.  It then ties a cell on any given sheet to a different
cell on the previous sheet, so you can track how much extra money you
accumulate over time.  Anyone else who wants it let me know and I'll
send it off-list.)

<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest
xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"
manifest:version="1.2">
...several different manifest entries appear here, add the following lines:
<manifest:file-entry
manifest:full-path="Scripts/python/WeekEndingCalculator.py"
manifest:media-type="application/binary"/>
 <manifest:file-entry manifest:full-path="Scripts/python/"
manifest:media-type="application/binary"/>
 <manifest:file-entry manifest:full-path="Scripts/"
manifest:media-type="application/binary"/>
</manifest:manifest>

On Fri, Mar 18, 2016 at 10:36 PM, Paul Hammant <paul@hammant.org> wrote:
I have tried all the security levels, with re-launches of LibreOffice in
between.  Yes I can run the sample Python macros.

- Paul

On Fri, Mar 18, 2016 at 9:52 PM, Jim Byrnes <jf_byrnes@comcast.net> wrote:

On 03/18/2016 03:55 PM, Paul Hammant wrote:

I have not worked out how to activate it :-(
Ref  http://listarchives.libreoffice.org/global/users/msg47885.html

-ph


I see from the link you are on a Mac. I am on linux but the last part of
your path to the script seems to be about the same as mine would be.

Have you set the macro security to a level that will allow you to run
macros? I've been tripped up by this a couple of times on new installs.

Can you run any of the sample python macros that come with LO? If you can
maybe that indicates a path issue after all.

Regards,  Jim


On Fri, Mar 18, 2016 at 10:44 AM, Mark Stanton <mark@vowleyfarm.co.uk>
wrote:

Does the Python macro interface work?
Does it work well if it does work?

Mark

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems?
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be
deleted






--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems?
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be
deleted


--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.