<?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 Re: Batch Export And Print Script/Tool stopped working in 10.2 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590103#M46269</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ran this successfully in ArcMap 10.2.1...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Sep 2015 22:28:55 GMT</pubDate>
    <dc:creator>MichaelNorelli</dc:creator>
    <dc:date>2015-09-03T22:28:55Z</dc:date>
    <item>
      <title>Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590100#M46266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all. I have been using below script/tool for a very long time and have gotten used to how easy it was for me to take 100+ maps, click 2 things and come back to beautifully exported or printed dataset. My tool has stopped immediately after we upgraded to 10.2 from 10.0. I am sure it is something as silly as missing a squigly line somewhere. It seems that every release of arcmap is followed by some minor change. Initially with VB to Py I had to source all scripts to make them work and now my main stopped working. Any thoughts/comments would be appreciated. Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
"""
Batch Export and Print
&amp;nbsp; This script takes MXD files
&amp;nbsp; and exports all the maps as selected

&amp;nbsp; @author Steven Porter
&amp;nbsp; @contact: porters1@ohio.edu
&amp;nbsp; @organization: The Voinovich School for Leadership and Public Affairs, Ohio University
&amp;nbsp; @version 1/20/11
"""

import arcpy, sys, os

#Input variables. Remember arcgis passes lists as semicolon delimited strings (files)
files= sys.argv[1]
yesPDF = sys.argv[2]
yesJPG = sys.argv[3]
yesPNG = sys.argv[4]
yesEMF = sys.argv[5]
yesAI = sys.argv[6]
yesPRINT = sys.argv[7]
printer = sys.argv[8] #relies on code to generate a list in the tool itself
outputFolder = sys.argv[9]
mergePDF = sys.argv[10]

#if outputFolder is empty use mxd location
if outputFolder=="#":
 outputFolder = os.path.dirname(files.split(";")[0])

if yesPDF=="true" and mergePDF =="true":
&amp;nbsp; combinedpdf = arcpy.mapping.PDFDocumentCreate(outputFolder + os.sep + "CombinedMaps.pdf")

#loop through each passed mxd file split the string back into the list
for file in files.split(";"):
 file=file.strip("'")
 
 
 #parse out the file name of the file 
 filename = os.path.basename(file)
 
 #get the name of file without any file extension
 mxd_name = filename.split(".")[0]
 #create a map object from the file
 map = arcpy.mapping
 map_document = map.MapDocument(file) 
 
 #Check for broken data sources
 brokenList = arcpy.mapping.ListBrokenDataSources(map_document)
 if brokenList:
&amp;nbsp; errorString = filename+" has broken data sources on layer(s): "
&amp;nbsp; for item in brokenList:
&amp;nbsp;&amp;nbsp; errorString = errorString + "'"+item.name+"'"
&amp;nbsp; arcpy.AddError(errorString)
&amp;nbsp; 
 # Set all the parameters as variables here:
 data_frame = 'PAGE_LAYOUT'
 resolution = "300"
 image_quality = "NORMAL"
 colorspace = "RGB"
 compress_vectors = "True"
 image_compression = "DEFLATE"
 picture_symbol = 'RASTERIZE_BITMAP'
 convert_markers = "TRUE"
 embed_fonts = "True"
 layers_attributes = "NONE"
 georef_info = "False"

 
&amp;nbsp; 
 #perform selected operations
 if yesPDF=="true":
&amp;nbsp; arcpy.AddMessage("Exporting: "+ filename+" as PDF")
&amp;nbsp; out_pdf = outputFolder + os.sep + mxd_name+ ".pdf"
&amp;nbsp; map.ExportToPDF(map_document, out_pdf, data_frame, 640, 480, resolution, image_quality, colorspace, compress_vectors, image_compression, picture_symbol, convert_markers, embed_fonts, layers_attributes, georef_info)
&amp;nbsp; if mergePDF =="true":
&amp;nbsp;&amp;nbsp; combinedpdf.appendPages(out_pdf)
&amp;nbsp;&amp;nbsp; 
 if yesJPG=="true":
&amp;nbsp; arcpy.AddMessage("Exporting: "+ filename+" as JPEG")
&amp;nbsp; out_jpg = outputFolder + os.sep + mxd_name+ ".jpg"
&amp;nbsp; map.ExportToJPEG(map_document, out_jpg)
&amp;nbsp; 
 if yesPNG=="true":
&amp;nbsp; arcpy.AddMessage("Exporting: "+ filename+" as PNG")
&amp;nbsp; out_png = outputFolder + os.sep + mxd_name+ ".png"
&amp;nbsp; map.ExportToPNG(map_document, out_png, data_frame, 640, 480, resolution)
&amp;nbsp; 
 if yesEMF=="true":
&amp;nbsp; arcpy.AddMessage("Exporting: "+ filename+" as EMF")
&amp;nbsp; out_emf= outputFolder + os.sep + mxd_name+ ".emf"
&amp;nbsp; map.ExportToEMF(map_document, out_emf, data_frame, 640, 480, resolution, image_quality, "#", picture_symbol, convert_markers)
&amp;nbsp; 
 if yesAI=="true":
&amp;nbsp; arcpy.AddMessage("Exporting: "+ filename+" as AI")
&amp;nbsp; out_AI= outputFolder + os.sep + mxd_name+ ".ai"
&amp;nbsp; map.ExportToAI(map_document, out_AI)
&amp;nbsp; 
 if yesPRINT=="true":
&amp;nbsp; arcpy.AddMessage("Printing: "+filename)
&amp;nbsp; map.PrintMap(map_document, printer)
&amp;nbsp; 

 del map #delete the map opject

if yesPDF=="true" and mergePDF =="true":
&amp;nbsp; combinedpdf.saveAndClose()
&amp;nbsp; del combinedpdf
# This gives feedback in the script tool dialog

arcpy.GetMessages()

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Dec 2013 15:09:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590100#M46266</guid>
      <dc:creator>YaroslavZaitsev</dc:creator>
      <dc:date>2013-12-06T15:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590101#M46267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How has it stopped working?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have a line number or error message to help narrow down the issue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 14:29:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590101#M46267</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2013-12-09T14:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590102#M46268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It just stopped working. It goes into red X and halts the script and does not produce any error messages. But when I put the text into IDLE to run the tool it tells me that there is an error on line 15&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "G:\share\arcgis\toolboxes\BatchExportandPrint.py", line 15, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; files= sys.argv[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IndexError: list index out of range&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have taken a few python classes in past couple of years. I think this error means that there are no variables... ok since this is a script and script came with a tool referring to the script. In tool you specify arguments (aka inputs)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In Arcmap itself it does this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It accepts all the maps and runs the tool and then nothing happens. I see a red X saying tool did not run. A little failure window does not pop up and no error message shows up. Please see attached screenshot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 15:06:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590102#M46268</guid>
      <dc:creator>YaroslavZaitsev</dc:creator>
      <dc:date>2013-12-09T15:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590103#M46269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ran this successfully in ArcMap 10.2.1...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Sep 2015 22:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590103#M46269</guid>
      <dc:creator>MichaelNorelli</dc:creator>
      <dc:date>2015-09-03T22:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590104#M46270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are you running this tool?&amp;nbsp; It appears as if it is not getting the sys.argv[1] passes to the script.&lt;/P&gt;&lt;P&gt;If a script tool, might want to check the properties and make sure all the parameter info is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 17:38:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590104#M46270</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2015-09-08T17:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590105#M46271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;...by doing this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I downloaded the whole toolbox and &lt;STRONG&gt;bin&lt;/STRONG&gt; directory from here: &lt;A href="https://github.com/snowballsteve/ArcGIS_Scripts" title="https://github.com/snowballsteve/ArcGIS_Scripts"&gt;snowballsteve/ArcGIS_Scripts · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Under the toolboxes directory: &lt;STRONG&gt;C:\Users\&amp;lt;user&amp;gt;\AppData\Roaming\ESRI\Desktop10.2\ArcToolbox&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I stored the &lt;STRONG&gt;bin &lt;/STRONG&gt;directory containing the python script above in &lt;STRONG&gt;..\My Toolboxes\bin&lt;/STRONG&gt;.&amp;nbsp; The toolbox this script is called from, ArcGIS_Scripts.tbx, I stored in &lt;STRONG&gt;..\MyToolboxes&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcMap, I open Catalog &amp;gt; Toolboxes &amp;gt; My Toolboxes &amp;gt; ArcGIS_Scripts.tbx, and underneath is "Batch Export and Print".&lt;/P&gt;&lt;P&gt;Right-clicking and choosing Properties, I can see that the script above is listed under the Source tab as the Script File.&lt;/P&gt;&lt;P&gt;In the Parameters tab, I can see these:&lt;/P&gt;&lt;P&gt;Input MXD Documents &lt;/P&gt;&lt;P&gt;PDF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;JPG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;PNG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;EMF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;AI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;PRINT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Printer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Output Folder&lt;/P&gt;&lt;P&gt;Merge PDF&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Double-clicking the tool runs it.&amp;nbsp; This pops up the dialog where I specify my directory of MXDs and the checkboxes to say what I want done with them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runs with no errors and nice outputs!&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 18:50:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590105#M46271</guid>
      <dc:creator>MichaelNorelli</dc:creator>
      <dc:date>2015-09-08T18:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590106#M46272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was struggling with the same problem; the code just stopped working.&lt;/P&gt;&lt;P&gt;I finally found a solution, that wokrs for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the scipt properties check the options: "Always run in foreground"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Matej&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jan 2016 10:54:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590106#M46272</guid>
      <dc:creator>MatejCunder</dc:creator>
      <dc:date>2016-01-04T10:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590107#M46273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This worked perfectly for me! Thank you.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Dec 2016 21:35:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590107#M46273</guid>
      <dc:creator>DanielleLee</dc:creator>
      <dc:date>2016-12-13T21:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export And Print Script/Tool stopped working in 10.2</title>
      <link>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590108#M46274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anyone have any luck with this in 10.5?? I'm getting the same thing as OP with his script, mysterious red X.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Apr 2019 22:03:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/batch-export-and-print-script-tool-stopped-working/m-p/590108#M46274</guid>
      <dc:creator>Seanmmm</dc:creator>
      <dc:date>2019-04-15T22:03:33Z</dc:date>
    </item>
  </channel>
</rss>

