I'm a little confused (as is Python).
The line:
mxds_List = glob.glob('*.mxd')
creates a Python list of strings representing filenames of your .MXDs. The line:
for mxd in mxds_List:
iterates through those strings, plugging each one into mxd. That's
just a string at that point. Do you want to parse the filename, strip
the .mxd extension and replace it with .shp?
-Eric
-=--=---=----=----=---=--=-=--=---=----=---=--=-=-
Eric B. Wolf 720-334-7734
On Thu, May 5, 2011 at 7:37 PM, George Corea <[email protected]> wrote:
> Hi,
>
> I want to create a single shape file from multiple mxd's that have
> multiple frame sets with different extents in them. I have found/
> started a script to do this (attached) but can't figure out how to
> write the captured X&Y Max/Min into the shape file that is created for
> this. See output below. I also want it to write the scale and title of
> the frame as well as the file name of the mxd.
>
> Would appreciate your help in completing this script.
>
> Thanks,
>
>>>> import arcpy, os, glob
> ... #path = 'c:\\temp\\george\\'
> ... path = 'P:\\2011\\Job_031_TownPlanning_SeriesProduction\\Working\
> \mxd\\1'
> ... os.chdir(path)
> ... mxds_List = glob.glob('*.mxd')
> ... count_Mapdocs = len(mxds_List)
> ... print 'Processing ' + str(count_Mapdocs) + 'map documents...'
> ... #Create Polygon Shapefile
> ... arcpy.CreateFeatureclass_management(path, 'extents.shp',
> "POLYGON")
> ... #Start Loop
> ... for mxd in mxds_List:
> ... mapDoc = arcpy.mapping.MapDocument(mxd)
> ... dataframe = arcpy.mapping.ListDataFrames(mapDoc,'*')[0]
> ... frameExtent = dataframe.extent
> ...
> ... #Frame Scale
> ... frameScale = dataframe.scale
> ... #Frame Extent
> ... ExtentXMax = frameExtent.XMax
> ... ExtentXMin = frameExtent.XMin
> ... ExtentYXax = frameExtent.YMax
> ... ExtentYMin = frameExtent.YMin
> ...
> ... point_object = mxd.shp
> ... #Write in table scale
> ... #Write in table
>
> Processing 14map documents...
>
> Runtime error <type 'exceptions.AttributeError'>: 'str' object has no
> attribute 'shp'
>