1

I have made three different script tools to run in a module that is going to clean multiple sets of data as I get them.

import arcpy
fc = "C:\Users\CartoFront\Desktop\Chicago Update\Chicago Update.gdb\ChiMetroJoin12012016practice"
arcpy.AlterField_management(fc, "SitusStdHouseNbr", "sthsnum", "sthsnum")
arcpy.AlterField_management(fc, "SitusStdDirectionLeft", "stdir", "stdir")
arcpy.AlterField_management(fc, "SitusStdStreet", "ststname", "ststname")
arcpy.AlterField_management(fc, "SitusStdMode", "stsuffix", "stsuffix")
arcpy.AlterField_management(fc, "SitusStdUnitType", "stunitprfx", "stunitprfx")
arcpy.AlterField_management(fc, "SitusStdUnitNbr", "stunitnum", "stunitnum")

I have previously just been editing the fc every time I run the script for the necessary input. However, I find this very counter-intuitive because I enter the same file input into my script tool every time I run it. Is there any way that I am able to set my inital fc variable to the input that I am entering into my script tool?

  • My apologies, just made the edit to change that. I have read through both of those Esri Help desk pages prior to asking, maybe I am just looking over the answer that is there. Just boggled down with the codes they provide for examples. I cant seem to see a way to set my initial code variable to the input in that example, is it just convoluted? Do you have any input on where I could look within that code? Sorry! – ducksfloat Dec 2 '16 at 21:53
  • I am running it as an actual script tool from a custom ArcGIS toolbox – ducksfloat Dec 2 '16 at 22:00
2

Add a feature class or feature layer parameter in the script tool properties (right click the tool in your custom toolbox). Then use fc = arcpy.GetParameterAsText(0) in your script.

See Setting script tool parameters and Accessing parameters in a script tool for more details.

  • Works perfect. Thank you so much for your help, I greatly appreciate it. – ducksfloat Dec 6 '16 at 16:22

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.