Hot folder script

Previous topic - Next topic

ScripterBoy

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.

a.l.e

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

ScripterBoy

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

a.l.e

well, you have to first

import os

before using it...

ScripterBoy

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.