Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Scribus to print labels with serial numbers for my devices. Is there a way that I can automatically read and insert the serial numbers I want to print into Scribus from a text file (or even a Google doc)?

The idea is the following: I define fields in Scribus , and autopopulate the values of this fields form a text file.

Is this possible?

share|improve this question
up vote 1 down vote accepted

I used python to edit the file.

    # this script populates the scribus template for the SN of FuelSpy
    # Olmo Mezger
    import re # regular expression
    import os.path #for os path operations

    myFile_Tempate = "SN_Template.sla"
    myFile_Out = "SN_Tier_01.sla"

    i_start = 1
    i_number = 27*7

    # check if file exists
    if os.path.isfile(myFile_Out):
        print 'aborting, output file exist and I dont want to overwrite it. Delete it manually if you want to continue',
        print 'continue'

    f_in = open(myFile_Tempate, 'r')
    f_out =open(myFile_Out, 'w')

    # loop
    i = i_start
    for line in f_in:
        #print line
        myString = line
        if myString.find('%') == -1: # it does not have %
            myNumber = '%0*d' % (4, i)
            myNewString = myString.replace('%',myNumber)
            #print myNewString
            print i
            i = i+1

    print "done"
share|improve this answer

There is also Scribus Generator that takes data from a CSV file and replaces variables inside Scribus documents. See

share|improve this answer
If I only knew this before... thanks, but my script is working pretty well :-) – otmezger Mar 10 '13 at 8:08

Scribus ITEXT read


$xmldata=[xml](gc 'C:\1\menu_template1.sla')


Tested number


$xmldata=[xml](gc 'C:\1\menu_template1.sla')
$xmldata.SelectNodes("/SCRIBUSUTF8NEW/DOCUMENT/PAGEOBJECT[@ANNAME='Text1232']/ITEXT") | Set-Variable xmlnode

$xmlnode.SetAttribute("CH", "New Serial")

Scribus ITEXT write

share|improve this answer
Thank you for your answer. I made a python script for this task. You brought me to the idea that the file format is xml, so I can actually edit it via python. Here is my script: – otmezger Feb 16 '13 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .