Not sure if this is the sort of thing you were looking for but I might have something that will work for you.However, it requires a look up table containing map names and the text you want displayed.To use the code, the maps you want to run the code on should ALL contain the same textfor the element you want to change. For example, when I was testing the code I had thetext '<TextVariable>' on each map and it was set to be the text replaced by what wasstored in the look up table for that map document.So in my test, the text that said '<TextVariable>' became 'Map 001' in Map1.mxd, it became 'Map 002' in Map2.mxd and so on.This solution would require you to change the text after the map is completed. Also, the code can't be run on a map that is currently open.
#============================================
# Change Text Based Using Look Up Table
#============================================
import arcpy
import os
mxds = [r"C:\My_Stuff\GIS\Text\Map1.mxd","C:\My_Stuff\GIS\Text\Map2.mxd"] #List of mxds
table = [r"C:\My_Stuff\GIS\Text\DynamicText.gdb\LookupText"] # Lookup table
for mxd in mxds:
rows = arcpy.SearchCursor(table)
mapp = arcpy.mapping.MapDocument(mxd)
for row in rows:
val = row.getValue("MapName") #Fieldname containing map names
if val + ".mxd" == os.path.basename(mxd):
txt = row.getValue("Text") #Fieldname containing text string
txt_elms = arcpy.mapping.ListLayoutElements(mapp,"TEXT_ELEMENT")
for elm in txt_elms:
if elm.text == "<TextVariable>": #Text in all maps to be replaced
elm.text = txt
mapp.save()
del rows, row
You could also set the code to look for element names rather than textAlso, while I didn't have any trouble with the code, if you use the code you may want to test it on copiesof you maps first given that it saves the changes made.