0

The script is fully functional, but I need to convert it into a tool which will allow the user to customize work environment, expression, name of shapefile, name title text, update date text automatically, and select a output file.

The error message is:

The Microsoft Access database engine could not find the object 'GDB_ReleaseInfo'. Make sure the object exists and that you spell its name and the path name correctly.

enter image description here

enter image description here

I am new to ArcPy.

   # Import arcpy module
... import arcpy
... 
... #Set Work Environment Default File
... myWS = arcpy.GetParameterAsText(0)
... if myWS == '#' or not myWS:
...     myWS = r"C:/Tmp/GIS_Tmp" # Default value if none passed to script
... 
... #arcpy.env.workspace = myWS
... #arcpy.env.workspace = "C:\Tmp\GIS_Tmp"
... 
... # Script arguments
... Parcels = arcpy.GetParameterAsText(1)
... 
... Selection_type = arcpy.GetParameterAsText(2)
... if Selection_type == '#' or not Selection_type:
...     Selection_type = "NEW_SELECTION" # provide a default value if unspecified
... 
... Distance__Buff1 = arcpy.GetParameterAsText(3)
... if Distance__Buff1 == '#' or not Distance__Buff1:
...     Distance__Buff1 = "300 Feet" # provide a default value if unspecified
... 
... Distance__Buff2 = arcpy.GetParameterAsText(4)
... if Distance__Buff2 == '#' or not Distance__Buff2:
...     Distance__Buff2 = "500 Feet" # provide a default value if unspecified
... 
... Expression = arcpy.GetParameterAsText(5)
... if Expression == '#' or not Expression:
...     Expression = "\"AIN\" = ''" # provide a default value if unspecified
... 
... v300ft_shp = arcpy.GetParameterAsText(6)
... 
... v500ft_shp = arcpy.GetParameterAsText(7)
... 
... 
... # Local variables:
... #Parcel_Address = Parcels
... 
... #If layer already exist overwrite
... arcpy.env.overwriteOutput=True
... 
... #Create Parcels layer
... arcpy.MakeFeatureLayer_management("C:/Tmp/GIS_Tmp/Parcels.shp","Parcels.lyr")
...                                   
... 
... # Process: Select Layer By Attribute
... arcpy.SelectLayerByAttribute_management("Parcels.lyr", Selection_type, Expression)
... 
... # identify the current map document
... 
... mxd = arcpy.mapping.MapDocument('CURRENT')
...     
... # identify the data frame
... df = arcpy.mapping.ListDataFrames(mxd)[0]
...     
... # use the zoom to selected features method of the data frame to update the extent
... df.zoomToSelectedFeatures ()
... 
... #Set Scale
... df.scale = 3860
... 
... # Process: Buffer
... arcpy.Buffer_analysis("Parcels.lyr", "C:/Tmp/GIS_Tmp/300ft_shp", Distance__Buff1, "FULL", "ROUND", "NONE", "", "PLANAR")
... 
... #Import Symbology layer to buffer
... arcpy.ApplySymbologyFromLayer_management ("300ft_shp", "C:/Tmp/GIS_Tmp/Symbol_300ft.lyr")
... 
... # Process: Buffer (2)
... arcpy.Buffer_analysis("Parcels.lyr", "C:/Tmp/GIS_Tmp/500ft_shp", Distance__Buff2, "FULL", "ROUND", "NONE", "", "PLANAR")
... 
... #Import Symbology layer to buffer
... arcpy.ApplySymbologyFromLayer_management ("500ft_shp", "C:/Tmp/GIS_Tmp/Symbol_300ft.lyr")
... 
... # Update Text within Title
... import arcpy
... mxd = arcpy.mapping.MapDocument("CURRENT")
... for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
...     # Text not within Element
...     if elm.text == "Text":
...         elm.text = "fine"
... arcpy.RefreshTOC()
... del mxd
... 
... #Update Text for Date
... 
... from datetime import date, timedelta   
... mxd = arcpy.mapping.MapDocument("CURRENT")  
... #Where my code says "DateTimeElm" your text element needs to be named the same or change this name to reflect your text element  
... elm = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "DateTimeElm")[0]  
... elm.text = date.strftime(date.today() - timedelta(days=1), "Current: " + '%B %d, %Y')  
... arcpy.RefreshActiveView()
2

You can create a Script Tool by right clicking a Tool Box and selecting Add Script. Then configure your parameters on the Parameters tab.

Script Tool Documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.