Scribus > Layout Issues

Resize multiple text frames simultaneously

<< < (2/2)

Ewac:
Has there been a solution to this issue in the past years? I'm in the same situation and would really appreciate a way to rezise multiple frames together....

RobSay:
I'm not aware of any new solutions to this and I use scripter to achieve a similar sort of effect (standard width image frames over 250 pages)

For a straight forward resize of all frames within the whole document - you can run this in the scripter console:

--- Code: ---# select all the items in the document - you can be much cleverer than this with page ranges etc
allItems = getAllObjects()
# loop through all the objects
for item in allItems :
  # look for text frames only - you can be cleverer here in lots of ways and filter by type, name, property .. whatever
  if (getObjectType(item) == 'TextFrame'):
    # set the frame dimensions (you can calculate the desired width and height etc)
    sizeObject(200,30, item)
    # you could also move the text frame to a specific point on the page (might need to check the current page)
    # moveObjectAbs(x,y,item)

--- End code ---

Ewac:
I have tried this unsuccesfully, but I never worked with scrips ever and I am not even sure how to fill out the template you gave exactly. I have 300+ pages and need to change all the frames now.
If it's not too much to ask, could you show me how I have to adjuct the template script to change
every text frame in the document
to the size w 122mm, h 190mm
in the position x 10mm, y 10mm

RobSay:
Scripter can be a little finicky - but it is very powerful.

Try this:

* Create a new scribus document and add a Text frame anywhere on the first page
* Page Menu > Copy > Just OK on the dialog ... creates a second page
* Script Menu > Show Console > Copy the script below into the top field of the dialog
* Dialog Script Menu > RunThe text frame you created in step 1 and the text frame on the 2nd page should be resized to your dimensions and position (assuming your default doc is defined in mm).

If it's doing what you want ... open your 300 page document and repeat steps 3 & 4.


--- Code: ---pageNum = 1
totalPageCount = pageCount()
while (pageNum <= totalPageCount):
  gotoPage(pageNum)
  # select all text frame items on the current page
  allItems = getAllObjects(ITEMTYPE_TEXTFRAME)
  # loop through all the objects
  for item in allItems :
    sizeObject(122,190, item)
    moveObjectAbs(10,10,item)
  # next page
  pageNum +=1
# leave a blank line at the end for the scripter console - after this comment


--- End code ---
The final blank line is critical - as is all of the indentation (spaces not tabs)

AdmFubar:
While not an immediate solution, what seems to be a better option would be styles for images. This would allow changing the frame sizing, location, etc. . would be usfull for other objects as well.

Navigation

[0] Message Index

[*] Previous page

Go to full version