<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python code to make my script run every day replacing the pdf file with a new one in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200573#M15413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am very new to Python and have just made a script that will create a map book pdf file.&amp;nbsp; 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.&amp;nbsp; Here is the code I have so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfpath = "P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc = arcpy.mapping.PDFDocumentCreate("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mapdoc = arcpy.mapping.MapDocument("P:/Projects/Joseph/Map Book/MapBook.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mapdoc.dataDrivenPages.exportToPDF("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc.appendPages("P:/Projects/Joseph/Map Book/Cover.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc.appendPages("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc.saveAndClose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mapdoc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Oct 2013 16:31:08 GMT</pubDate>
    <dc:creator>JosephGrove</dc:creator>
    <dc:date>2013-10-23T16:31:08Z</dc:date>
    <item>
      <title>Python code to make my script run every day replacing the pdf file with a new one</title>
      <link>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200573#M15413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am very new to Python and have just made a script that will create a map book pdf file.&amp;nbsp; 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.&amp;nbsp; Here is the code I have so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfpath = "P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc = arcpy.mapping.PDFDocumentCreate("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mapdoc = arcpy.mapping.MapDocument("P:/Projects/Joseph/Map Book/MapBook.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mapdoc.dataDrivenPages.exportToPDF("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc.appendPages("P:/Projects/Joseph/Map Book/Cover.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc.appendPages("P:/Projects/Joseph/Map Book/Lewisville Parcel Map Book.pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfdoc.saveAndClose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mapdoc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 16:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200573#M15413</guid>
      <dc:creator>JosephGrove</dc:creator>
      <dc:date>2013-10-23T16:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Python code to make my script run every day replacing the pdf file with a new one</title>
      <link>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200574#M15414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As long as the computer running it has python installed and the system variables are setup properly (i.e. if you double click on a .py file, it runs without asking what program to use), you can just set it up as a scheduled task in the Windows Task Scheduler or another program that provides the same sort of functionality (most RDBMS).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 17:07:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200574#M15414</guid>
      <dc:creator>MattSayler</dc:creator>
      <dc:date>2013-10-23T17:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Python code to make my script run every day replacing the pdf file with a new one</title>
      <link>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200575#M15415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2013/07/30/scheduling-a-scrip/"&gt;Here's a blog post on the subject&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 17:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200575#M15415</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2013-10-23T17:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python code to make my script run every day replacing the pdf file with a new one</title>
      <link>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200576#M15416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you so much for your answers and for the link to the blog post about setting up the task scheduler to run Python scripts.&amp;nbsp; This was very helpful and my script is now running successfully.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you again.&amp;nbsp; Have a great day!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 18:12:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code-to-make-my-script-run-every-day/m-p/200576#M15416</guid>
      <dc:creator>JosephGrove</dc:creator>
      <dc:date>2013-10-23T18:12:51Z</dc:date>
    </item>
  </channel>
</rss>

