Re: python script result

Neil Foster <[email protected]>
Newsgroups gmane.comp.graphics.scribus
Message-ID <CAOgXE4k1RgnBtMtwi9B+hmqx-ioy=cnJeGQUvhASgwS8AX6r4Q@mail.gmail.com>
You could use a basic python script to parse the XML of .sla file rather
than running a script from within Scribus.

E.g. 'countpages.py':

import xml.etree.ElementTree as ET
import sys

def main(args):
    filename = args[1]

    tree = ET.parse(filename)
    root = tree.getroot()

    pages =  root.findall('./DOCUMENT/PAGE')

    print(len(pages))

if __name__ == '__main__':
    main(sys.argv)

Then use it with:
python .\countpages.py "filename.sla"

And pipe that output into whatever you want.

Might be better ways, but I've been doing a lot of manipulating the .sla
files directly rather than using scribus recently so it's what came to mind.

Regards, Neil.







On Tue, 20 Apr 2021 at 22:17, JLuc <[email protected]> wrote:

> Hello,
>
> I'd like to use the page count of a document in a shell script (linux)
> A python script can access that count with `scribus.pageCount()`
>
> How can scribus script can output this as a string,
> so it's used in a shell script afterward ?
>
> I imagine doing it via writing the result in a text file.
> Is there maybe a better way ?
>
> JLuc
>
>
>
> ___
> Scribus Mailing List: [email protected]
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20210420/e29c5157/attachment.htm>
___
Scribus Mailing List: [email protected]
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:
http://wiki.scribus.net
http://forums.scribus.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.