How to identify currently selected field in the active ArcGIS table?

المشرف العام

Administrator
طاقم الإدارة
Since ArcGIS 10.1 (maybe greater) does not apparently have an easy way to select all of the values from a column (field) in the active table, I thought I could write a short ArcPy script to at least write the values to Python window.

The following code will write the values to the Python window if I pass it an explicit tablename and fieldname:

import arcpycur = arcpy.SearchCursor("myTableName")fieldname = "myFieldName"for row in cur: print row.getValue(fieldname)del row, curHowever, in order to make this a reusable Python tool, I would like to determine a way to identify:

  1. the active table (in the table window), and
  2. the active (highlighted) column/field in that table
at which point I can dynamically change the tablename and fieldname in the code above, based on what is selected.

Any ideas?



أكثر...
 
أعلى