Scribus > Layout Issues

Resize multiple text frames simultaneously

<< < (3/3)

Thiago David:
Hi, here is a solution I found today
I'm not a programmer so this code can be optimized

Go to Script menu> console> paste the code below and change the numbers

--- Code: ---page = 2                                                   #Click on your first text box and you will find the number, in my case was Text2
pagenum = scribus.pageCount()
content = []

while (page <= pagenum):
n = scribus.getPageItems()
for item in n:
selectObject("Text"+str(page))             #If you change the text box name then change here too
print "Text"+str(page)                     #Just to check if its working
scribus.sizeObject (W, H)                  #Change W to your width and H to your height
#scribus.moveObjectAbs (x, y)              #(Exemple)You can add other modifications too, just choose the function from the: Scribus' Automatic Scripter Commands list
page +=1
                                                           #Let this last line blank to work
--- End code ---

I found this thread while looking for a solution to resize multiple objects to the same fixed values.
The scripts I could find all scaled the objects existing size by a percentage, not to a fixed value as I wanted.
I solved this by modifying an existing script by Alessandro Rimoldi.

--- Code: ---import sys
   import scribus
except ImportError:
   print "This script only works from within Scribus"

n = scribus.selectionCount()

if n == 0 :
    scribus.messageBox('Error:', 'No frame selected');

w = int(scribus.valueDialog('Width', 'New width (in current unit)', '10'))
h = int(scribus.valueDialog('Height', 'New height (in current unit)', '10'))

for i in range(0, n):
    frame = scribus.getSelectedObject(i)
    scribus.sizeObject(w, h, frame)

--- End code ---


[0] Message Index

[*] Previous page

Go to full version