Select to view content in your preferred language

ArcGIS 10.1 python add-in usage of arcpy.GetParameterAsText

1135
5
Jump to solution
02-26-2013 09:30 AM
KarstenRank
Frequent Contributor
Hello to everyone,

is it possible to use arcpy.GetParameterAsText() for User Input e.g. for a table or a name of a featureclass?

 def onClick(self):         # Script arguments         import_file = arcpy.GetParameterAsText(0)          tab_gdb = arcpy.GetParameterAsText(1)          tab_mxd = arcpy.GetParameterAsText(2)          # Local variables:         Ausgabetabelle = import_file         Geodatenbank = env.workspace          # Process: Tabelle in Tabelle         arcpy.TableToTable_conversion(import_file, Geodatenbank, tab_gdb, "", "", "")          # Process: Tabellensicht erstellen         arcpy.MakeTableView_management(Ausgabetabelle, tab_mxd, "", "", "")         pass


This is my code I already wrote. But it doesn't open an window for value input.

Thanks alot,

krank42
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JonPedder
Deactivated User
Setup a python script in a toolbox, then call the script using

pythonaddins.GPToolDialog(toolboxname, scriptname) 

View solution in original post

0 Kudos
5 Replies
TimothyHales
Esri Notable Contributor
You will need to use the pythonaddins module with the OpenDialog or SaveDialog.  You can then pass that input to your tool.  Check out this blog which will give you an example:

Getting Results from Your Python Add-in Buttons
0 Kudos
KarstenRank
Frequent Contributor
For open files this works fine. But is it possible to ask for a parameter in a dialog box?
0 Kudos
JimCousins
MVP Alum
how about
import_file = raw_input("Enter file for input:  ")
0 Kudos
JonPedder
Deactivated User
Setup a python script in a toolbox, then call the script using

pythonaddins.GPToolDialog(toolboxname, scriptname) 
0 Kudos
KarstenRank
Frequent Contributor
I tried the raw_input but it doesn't work.

Writing a python script in a toolbox would be the easiest way, but I don't know the place of the toolbox. The addin is for my organization and there is no standard place for the toolboxes.
0 Kudos