AnsweredAssumed Answered

Add bookmark(.dat) file to  MXDs using arcpy?

Question asked by yaron148 on Dec 23, 2015
Latest reply on Feb 19, 2016 by starlene

Does anyone know any python script to import a bookmark (saved as a .dat) that was created and saved in folder by using arcpy?  I tried with this script but without a result- just the name of the projects printed:


import arcpy
from arcpy import env

env.workspace = r"D:\desktop\Project"
for mxdname in arcpy.ListFiles("*.mxd"):
    print mxdname
    mxd = arcpy.mapping.MapDocument(r"D:\desktop\Project\\" + mxdname)
    df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
    for bkmk in arcpy.mapping.ListBookmarks(mxd, 'Bookmark1', df):
        df.extent = bkmk.extent
del mxd


For clarity, i asked it in Importing external bookmark (.dat) files into many MXDs using arcpy? - Geographic Information Systems Stack Exchange