Scribus Forums

Scribus => Scripts and Plugins => Topic started by: ScripterBoy on September 07, 2018, 02:22:11 PM

Title: Hot folder script
Post by: ScripterBoy on September 07, 2018, 02:22:11 PM
Is it possible to create a Scribus script to be "hearing" a folder and when a file arrives into it, then start a text import process?.

I have been trying to implement a directory listing but python commands like os.listdir('.'): seems that does not work.

Thank you so much for your help.
Title: Re: Hot folder script
Post by: a.l.e on September 07, 2018, 02:57:28 PM
yes, it's very likely that there are ways to do that with python.

i've not done it yet, but it must be possible...

... just one question: what are the signs, of os.listdir('.') not working?
here it does what it is supposed to...

ciao
a.l.e
Title: Re: Hot folder script
Post by: ScripterBoy on September 07, 2018, 05:20:27 PM
As you can see, this is just a simple code for getting current directory contents, and then put this contents into a textframe called c1.

openDoc("c:/users/one/Desktop/tt.sla")
cad=''
for x in os.listdir('.'):
   cad=cad+x

insertText(cad,0,"c1")

But what I get on console, when I try running this is

NameError: name 'os' is not defined
Title: Re: Hot folder script
Post by: a.l.e on September 07, 2018, 05:36:47 PM
well, you have to first

import os

before using it...
Title: Re: Hot folder script
Post by: ScripterBoy on September 07, 2018, 07:12:07 PM
My apologies,

I´m not yet familiar enought with Python.

I´m gonna try to do a loop over the "scanned" directory and then, depending on what kind of file I will dectec arriving on it, I would like to launch another script from the loop, is it possible?

I´m sorry for my (big) mistake and thank you so much for your time.