-2

I created the following "trial.py":

import arcpy

#Get Name
Name = str(arcpy.GetParameterAsText(0))

Then I created a toolbox using ArcCatalog and then added a script, pointed the above script file. When I run from the ArcMap/Catalog by double clicking on the script name, it wont give a prompt/dialog to enter the user name. It just says "This tool has no parameters".

What does "0" in arcpy.GetParameterAsText(0) mean?

After getting the user input, I want to pass that parameter to a SQL query on a shapefile, and zoom the map to that location.

  • Update 1:

Do I need to set parameter in the properties sheet?

enter image description here

  • Update 2:

How do I focus the cursor on the text box so that I don't have to click on the text box using mouse?

Is there anything in Python like tab order in VB?

put on hold as too broad by PolyGeo 2 days ago

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Welcome to GIS SE! Some of our protocols can take a little getting used to but something to pay attention to is that each Question should contain only one question so that any Answers(s) can apply directly to it. Rather than add additional questions as updates to this Question I think you should research/ask each separately. – PolyGeo Jun 4 '14 at 21:23
2

GetParameterAsText retrieves information from toolbox parameters. Look here for how toolbox parameters work.

Look here and here on how to use variables in a SQL statement.

1

Getting user input is not really what arcpy does, if you use something like raw_input() in python the geoprocessor will either ignore it or have a melt down.. There is not a method I know of that will ask the user a question and get a response. This you can do with other libraries like PyWin; there are other packages with their own issues and benefits.

As for getting parameters from the tool to the script I've found that sys.argv[1] works just fine. Read about it here http://www.pythonforbeginners.com/system/python-sys-argv.

If you want to implement zooming map functionality consider arcgis addins. They come in python flavor, or you can use windows forms from C# or VB.net.

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