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?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Dec 2, 2016 at 21:27
2
  • 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! Commented Dec 2, 2016 at 21:53
  • I am running it as an actual script tool from a custom ArcGIS toolbox Commented Dec 2, 2016 at 22:00

1 Answer 1

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.

answered Dec 3, 2016 at 0:48
1
  • Works perfect. Thank you so much for your help, I greatly appreciate it. Commented Dec 6, 2016 at 16:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.