AnsweredAssumed Answered

Python script to enter name string

Question asked by jdrvar on Jul 23, 2013
Latest reply on Jul 23, 2013 by jamesfreddyc
I am attempting to write a Python script that selects a record in the attribute table, zooms to the selected feature, and prompts the user to enter their name. The name field already exists in the attribute table as a string type. How would I get the script to prompt the user to enter their name?Then, have the information they enter stored in the attribute table? I am going to have the users run the script from ArcToolbox.  I have tried the python addin to toolbar/button.  But, was unable to prompt the user to enter their name or zoom to selected feature without manually selecting the feature.

import arcpy  #Variables Parcels = arcpy.GetParameterAsText(0) arcpy.AddMessage(Parcels)  mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0] arcpy.AddMessage(  #Logic try:  whereClause = "RENUM = "+Parcels+""  arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)   df.extent = lyr.getSelectedExtent()  df.scale = df.scale*1.1  except:  print arcpy.GetMessages()