Accessing item attributes

Previous topic - Next topic

polpero

Hi

Is there a way (with scripter) to access a frame attributes as defined in rightClick on frame -> attributes...?
I would like to retreive data from the value and parameter fields...

I know how to access the frame:

...
    while (page <= pagenum):
        scribus.gotoPage(page)
        d = scribus.getPageItems()
        strpage = str(page)
        for item in d:
            if (item[1] == 4):
                rawname = item[0]
                ...


but not how to get the value inserted into it's attributes
is this possible?

Thanks...

Derek

#1
I realise this topic is more deceased than Monty Python's dead parrot, but I couldn't find any documentation about accessing attributes and kept finding myself back here, so if this stops someone else joining me in my rabbit hole, here's what I found ....

Attributes are stored as a dictionary, and can be accessed using (example snippet):


attributes = getObjectAttributes(item[0]) # Get list of attributes for item
for attribute in attributes: # For each attribute in current item
    if attribute.get('Name') == "TOC": # If the attribute name is "TOC"
        tocList[attribute.get('Value')] = page         # Add/update the value of the attribute to/on the tocList
        ...
        ...


Fields which can be accessed are:

  • Name
  • Type
  • Value
  • Parameter
  • Relationship
  • RelationshipTo
  • AutoAddTo

As I only needed to use Name and Value I didn't dive in any further, so can't comment further.

dragonfly


XMLCopyEditor https://xml-copy-editor.sourceforge.io/ can open any *.sla file (which is XML format).  Attributes can be inspected. But of course you can use other methods like scripting.