tornado_f5

Python code to make my script run every day replacing the pdf file with a new one

Discussion created by tornado_f5 on Oct 23, 2013
Latest reply on Oct 23, 2013 by tornado_f5
I am very new to Python and have just made a script that will create a map book pdf file.  What I am trying to do now is determine what python script I would have to add to make this run every day to create an updated map book while deleting the map book pdf file from the previous day.  Here is the code I have so far:

import arcpy
pdfpath = "P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf"
pdfdoc = arcpy.mapping.PDFDocumentCreate("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")
mapdoc = arcpy.mapping.MapDocument("P:/Projects/Joseph/Map Book/MapBook.mxd")
mapdoc.dataDrivenPages.exportToPDF("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")
pdfdoc.appendPages("P:/Projects/Joseph/Map Book/Cover.pdf")
pdfdoc.appendPages("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")
pdfdoc.saveAndClose()
del mapdoc

Thank you in advance for your help.

Outcomes