AnsweredAssumed Answered

Setting a Script to Script Tool in Toolboxes

Question asked by MLCouden on Feb 28, 2013
Latest reply on Feb 28, 2013 by csny490
Have a question. So to put my script in a script tool, I need to add Parameter information into the code. When you create a script tool you have to set its parameters from your code to have it work. And I don't think my code has parameters set because it does what I ask it to do programmatically not systematically. Please look at my code below and let me know if I'm right.

import arcpy, os
folderPath = r"C:\2 - GEO-DATA PROCESSING SUPPORT\Permanent Site Maps\2_District MXDs"
for filename in os.listdir(folderPath):
    fullpath = os.path.join(folderPath, filename)
    if os.path.isfile(fullpath):
        basename, extension = os.path.splitext(fullpath)
        if extension.lower() == ".mxd":
            mxd = arcpy.mapping.MapDocument(fullpath)
            pdfPath = r"K:\PRODUCTS\Maps\Printable Maps\Test Permanent Site Maps"
            arcpy.mapping.ExportToPDF(mxd, pdfPath + os.sep + basename.split("\\")[-1] + '.pdf')