[scribus] checking whether current document name contains a string
a.l.e
ale.comp_06 at xox.ch
Tue Sep 20 05:22:43 UTC 2011
On Mon, 19 Sep 2011 15:44:40 -0400
Fred Zimmerman <wfz at nimblebooks.com> wrote:
> No, I mean to check in the scripter whether the name of the Scribus
> document that the scripter is working on includes a given string.
> There is a getDocName patch for v 1.5.0
> http://bugs.scribus.net/view.php?id=8597 but I am hoping for another
> approach that will work in 1.4.0 rc5. There are os.path.split and
> os.path.basename commands in python (import os) but I can't get them
> to work.
getDocName() seems to be a regular function of scribus...
however, this is what you are looking for:
import scribus
import os
import re
scribus.getDocName()
name = os.path.basename(scribus.getDocName())
if (re.search("stringtomatch", name)) :
scribus.messageBox("name", name)
else :
scribus.messageBox("name", "none")
just replace "stringtomatch" by the string you want to match.
(btw, i don't think that what you want to do is really something i would want to do... matching the file name? brrrrr... :-)
ciao
a.l.e
More information about the scribus
mailing list