On 3/9/21 2:19 PM, Matt Miller wrote: > I'm trying to use the API to copy a text frame to a different page of the > same document, then change the frame's name and position. copyObjects() / > pasteObjects() works for me to get the frame copied, but I'm not able to > change the new frame's name. I'm thinking to use getObjectAttributes() / > setObjectAttributes() to change the new frame's name, but > getObjectAttributes() always returns an empty list. For example, I execute > this from the scripter console: > > dummy = newDocument((5, 3), (0, 0, 0, 0), PORTRAIT, 1, UNIT_INCHES, PAGE_1, > 0, 2) > gotoPage (1) > orig_name = createText (1, 1, 1, 1) > copyObjects (orig_name) > gotoPage (2) > new_name = pasteObjects () > new_attrs = getObjectAttributes (new_name[0]) > print (len (new_attrs)) > > and that last print statement shows that the attribute list is empty. I > expected getObjectAttributes() to return a list of dictionary, and that I > could then update the first (and only) dictionary in that list, changing the > value of the "Name" element to the new name I want for the copied frame. > > What's wrong with how I''m using the API here, and/or, is there another way > to accomplish this?
Hi Matt, When you paste the object, new_name should contain a name assigned by Scribus. To be safe you might need to specify new_name[0]. To set the name to something else you use setItemName("changetoname", new_name[0]) -- this is in Setting Object Properties in the manual menu. I've never quite been able to figure out what these "attributes" are that you get from getObjectAttributes(). Greg ___ Scribus Mailing List: scribus@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