Just for fun, I found a not very performing solution...
For each layer I get field list and I try to use the name field to the data driven, otherwise I break the cicle; if all the fields name work in data driven I check the number of field with the cicle progressive and I get the layer name... (and in my script tool I get the filter in my parameter to compose the file name to export with data driven...)
import arcpy, os
mxd = arcpy.mapping.MapDocument("CURRENT")
trovato = 0
for lyr in arcpy.mapping.ListLayers(mxd):
try:
trova_layer = arcpy.mapping.ListLayers(mxd, lyr)[0]
elenco_campi = arcpy.ListFields(trova_layer)
numero_campi_trova = len(elenco_campi)
for field in elenco_campi:
campo_trova = field.name
try:
campo_ddp = eval("mxd.dataDrivenPages.pageRow." + campo_trova)
trovato = trovato + 1
except:
trovato = 0
break
if trovato == len(elenco_campi):
break
except:
trovato = 0
index_layer = trova_layer