Hi!
So finally I made some progress in programming. But I am still not completely happy.
It works fine ,if there are only "normal" layers (raster, shape) BUT if I use GroupLayers it gets totally messed up. What happens is that the code "destroys" the group layer and converts it to a "normal" layer. This causes the longName of layers in the former grouplayer to change and my sorting Code is useless. GroupAnnotationLayers get messed up totally and several new singleannotation layers are generated.
Any idea how to access the grouplayer or any other samrt idea to solve this problem.
Thanks
Chris
p.s. here my code
import arcpy
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd, "")[0]
mxd2 = arcpy.mapping.MapDocument(r"C:\Master\Master.mxd")
df2 = arcpy.mapping.ListDataFrames(mxd2, "")[0]
refLayer = arcpy.mapping.ListLayers(mxd,"",df)[1]
for lyr2 in arcpy.mapping.ListLayers(mxd2,"",df2):
c=lyr2.longName
d=lyr2.description
MasterLayer=c+d
print MasterLayer
for lyr in arcpy.mapping.ListLayers(mxd,"",df):
a=lyr.longName
b=lyr.description
moveLayer= a+b
print moveLayer
if MasterLayer==moveLayer:
moveLayer=lyr
arcpy.mapping.MoveLayer(df,refLayer,moveLayer, "After")
refLayer=moveLayer
print MasterLayer,moveLayer
mxd.save()
del mxd