How to get file properties via python macro?

Main Menu File>Properties…

Tab Description> Title

And

Tab Custom Properties

I need to pass this information to python variables

....getDocumentProperties().Title?

Hallo

    …
    doc = XSCRIPTCONTEXT.getDocument()
    docproperties = doc.DocumentProperties
    mytitle = docproperties.Title
    …

Thanks, this work:

ODOC = XSCRIPTCONTEXT.getDocument()
test_title = ODOC.getDocumentProperties().Title
print(test_title , '\n')

use mri

To get to Custom Properties you need to call getUserDefinedProperties. From there you can get or set properties:

    …
    doc = XSCRIPTCONTEXT.getDocument()
    docproperties = doc.DocumentProperties
    udp = docproperties.getUserDefinedProperties()
    myprop1 = udp.MyProp1  # get property
    udp.MyProp2 = myprop2  # set property that already exists
    udp.addProperty('MyProp3', 0, 'Hello, World') # make new string property
                                                  # 0 string  1 DateTime  2 Date  3 Duration 4 number 5 boolean
    …
1 Like