I'm new to python and just upgraded ArcGIS 10. I've been experimenting with python and I'm trying to batch clip several layers in ArcMaps TOC. The number of layers can change depending on the user. The script runs without any errors, however nothing happens. I can make a clip of a single layer based on another layer work, but when I change the code and try to implement a loop to batch the process I'm getting stuck.
here's my code
import arcpy.mapping
arcpy.AddToolbox("C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Analysis Tools.tbx")
clip = arcpy.GetParameterAsText(0) # input, required, single value
outFC = arcpy.GetParameterAsText(1) # output, required, single value
toclip = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListLayers(toclip)
try:
fcs = arcpy.mapping.ListLayers(toclip)
fcs.Reset()
fc = fcs.Next()
while fc:
outFeatureClass = outFC +"/" + arcpy.ValidateTableName(fc, outFC)
arcpy.Clip_analysis(fc, clip, outFeatureClass, "")
fc = fcs.Next()
except:
arcpy.GetMessages(2)
Thanks!