Home/ Reference/ Object Data

shape.Name

The object name shown in the Object Manager. Read/write — name things in one pass and every later script can find them exactly, which beats hunting by index.

Signature

shape.Name

Notes

The object name shown in the Object Manager. Read/write — name things in one pass and every later script can find them exactly, which beats hunting by index.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shapes = app.ActiveSelectionRange

for i in range(1, shapes.Count + 1):
    s = shapes.Item(i)
    print("Old name: ", s.Name)
    s.Name = "batchA_" + str(i).zfill(3)             # rename them all
    print("renamed to: ", s.Name)

About this section: Object Data

Object Data — object data and document properties.

Other entries in this section