I am trying to do something that I thought would be simple! We use a number of shapefiles frequently and I'd like to create buttons within ArcMap that you click that will add a particular shapefile to the Table of Contents. I decided I would write the code in Python, add that as a Script in Arctoolbox and somehow make a button that will look at that Script. Anyway, the code I'm using SEEMS to be working. However, I can't seem to see the layer within the Table of Contents. Below is the code I'm using that I am adding a Script to (no Parameters). import arcpy mxd = arcpy.mapping.MapDocument("C:\\Gis\\Python\\mxd\\test2.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] addLayer = arcpy.mapping.Layer("C:\\Gis\\GisMaps\\Attica\\layer.lyr") arcpy.mapping.AddLayer(df, addLayer) arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, addLayer Any help would be much appreciated, thanks!
... View more