[scribus] checking whether current document name contains a string

Fred Zimmerman wfz at nimblebooks.com
Tue Sep 20 14:33:50 UTC 2011


Thanks! perfect.

I am working with a vendor who sends cover templates with standardized file
names so this is fairly safe.  I am providing for exceptions.

FredZ





On Tue, Sep 20, 2011 at 01:22, a.l.e <ale.comp_06 at xox.ch> wrote:

> 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
>
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> 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/20110920/d19ffe94/attachment.html>


More information about the scribus mailing list