Here is some sample code that I was able to get working. You will need to create an array and add the XMAX, XMIN, etc to the array to create the polygon feature. Then you can create a feature class/shapefile from this array. I had trouble getting the Append tool to work with the array feature so I created a feature class for each extent, merged them together, and then deleted the original extent feature classes.import arcpy, glob, os
from arcpy import env
from arcpy import mapping
env.overwriteOutput = True
path = r"C:\temp"
mxdList = glob.glob(path + "\*.mxd")
env.workspace = r"C:\temp\Test.gdb"
y = 1
for mxd in mxdList:
mxd2 = mapping.MapDocument(mxd)
dataframe = mapping.ListDataFrames(mxd2, "*")[0]
frameExtent = dataframe.extent
XMAX = frameExtent.XMax
XMIN = frameExtent.XMin
YMAX = frameExtent.YMax
YMIN = frameExtent.YMin
pnt1 = arcpy.Point(XMIN, YMIN)
pnt2 = arcpy.Point(XMIN, YMAX)
pnt3 = arcpy.Point(XMAX, YMAX)
pnt4 = arcpy.Point(XMAX, YMIN)
array = arcpy.Array()
array.add(pnt1)
array.add(pnt2)
array.add(pnt3)
array.add(pnt4)
array.add(pnt1)
polygon = arcpy.Polygon(array)
arcpy.CopyFeatures_management(polygon, "Polygon_Extent" + "_" + str(y))
y = y + 1
list = []
lstFCs = arcpy.ListFeatureClasses("Polygon_Extent*")
for fc in lstFCs:
list.append(fc)
arcpy.Merge_management(list, "Extent")
for item in list:
arcpy.Delete_management(item)