[Scribus] Please help with 'simple' scripting task - print the current document

Bill Hudacek bill.hudacek
Fri Jun 22 15:44:39 CEST 2007


Thank you, Jon, but I've seen that page.  It only causes me to scratch
my head.  There is no example code there for 'lusers' such as myself.

I don't know a thing about Python (I just started looking at it this
week).

 From the list of attributes, it makes it seem as though I'd need to
create/get an object, call some function to set one or more
attributes, and then call 'print()' --- can you tell I'm more familiar
with Java? :-)

I've lost 3 days now because I can't print the current page from a
script.  I'm having trouble believing it myself - Petr made it sound
so simple...

It's morning here.  Tonight, I fall all over myself apologizing for
not being able to do this simple thing. And I start over with ms-word.
Unless I can get this working

Again, just in case I made some horrible mistake in copying
'boilerplate.py', here's most of my script:


#===================================================================
import sys

try:
    import scribus
    from scribus import progressTotal
    from scribus import progressSet
    from scribus import setText
    from scribus import messageBox
    # commented out, made no difference -> from scribus import Printer
except ImportError,err:
    print "This Python script is written for the Scribus scripting 
interface."
    print "It can only be run from within Scribus."
    sys.exit(1)

def main(argv):
    # 350 pages at 4 tickets/page
    myLimit=3
    idx=0
    for idx in range(1,myLimit):
         setText(unicode(("00" + `(idx*2)+0`)[-3:], 'iso-8859-1'), "num11")
         setText(unicode(("00" + `(idx*2)+0`)[-3:], 'iso-8859-1'), "num12")
         setText(unicode(("00" + `(idx*2)+1`)[-3:], 'iso-8859-1'), "num21")
         setText(unicode(("00" + `(idx*2)+1`)[-3:], 'iso-8859-1'), "num22")
         setText(unicode(("00" + `(idx*2)+2`)[-3:], 'iso-8859-1'), "num31")
         setText(unicode(("00" + `(idx*2)+2`)[-3:], 'iso-8859-1'), "num32")
         setText(unicode(("00" + `(idx*2)+3`)[-3:], 'iso-8859-1'), "num41")
         setText(unicode(("00" + `(idx*2)+3`)[-3:], 'iso-8859-1'), "num42")
         scribus.Printer().print()
         idx+=1
         result = messageBox('Monkeys!', str(idx) )
#===================================================================

Thanks, once again, everyone.  Scribus rocks - for the most part!

/Bill

jon wrote:
 >
 > I cannot help you directly but you may get some benefits from this:
 >
 > http://docs.scribus.net/index.php?lang=en&page=scripterapi-Printer
 >
 > Jon
 >
 > _______________________________________________
 > Scribus mailing list
 > Scribus at nashi.altmuehlnet.de
 > http://nashi.altmuehlnet.de/mailman/listinfo/scribus
 >





More information about the scribus mailing list