Scribus Forums

Scribus => Scripts and Plugins => Topic started by: ScripterBoy on September 07, 2018, 02:50:48 pm

Title: Launching scribus script, from outside of Scribus
Post by: ScripterBoy on September 07, 2018, 02:50:48 pm
Is there any way for starting an scribus script from an external python script?.

Thank you in advance.
Title: Re: Launching scribus script, from outside of Scribus
Post by: a.l.e on September 07, 2018, 03:11:43 pm
No, strictly speaking, you cannot.

But you can start with Scribus 1.5 with a startup script and get it to automatically quit.

https://wiki.scribus.net/canvas/Command_line_scripts

You still need the GUI to start, but it works...

If this fits your needs, I can further help you...
Title: Re: Launching scribus script, from outside of Scribus
Post by: ScripterBoy on September 07, 2018, 03:24:21 pm
Thank you so much for your answer.

So, in that case, is it possible to create a python script acting like "daemon", which would be "hearing" over one folder? (I would like to use Scribus inside a workflow, and I need to launch some processes when a file arrives to one folder)

Once again... thank you for your help.
Title: Re: Launching scribus script, from outside of Scribus
Post by: a.l.e on September 07, 2018, 03:58:54 pm
please, don't ask twice the same question...

you can find my reply in http://forums.scribus.net/index.php/topic,3055.msg14180.html#msg14180
Title: Re: Launching scribus script, from outside of Scribus
Post by: dragonfly on September 07, 2018, 06:27:01 pm
Quote
Is there any way for starting an scribus script from an external python script?.

Yes, in my own kicking around with building a Scribus custom workflow I have found ways of “pushing” content (document fragments) into a Scribus *.sla file. 

The usual approach is to have Scribus GUI open and launch a python script through Scribus window > scripts to "pull" content into Scribus.  Each script must import scribus.

However in some scenarios Scribus may not be present.

The approach I have tested for my own ends is to regard the template *.sla as an *.xml file and then use xquery script to update the xml elements in the *.sla document without the need to launch Scribus GUI.   The *.sla templates are held in an xml nosql database. The xpaths to textframe or imageframe or even styles must be known in advance and these can easily be found from any xml editor. This is indeed “pushing” content instead of "pulling".

In your workflow you would have a daemon watching your folder and on change trigger the xquery script to push content into xml elements.

Python elementtree will also do this.