AutoRun Tool Based on Changes

3262
6
11-20-2014 10:58 AM
ISP_graynic
Occasional Contributor II

I was wondering if it is possible to set up a tool in ArcMap so it automatically runs when a change is made to a layer.  For example, when a new feature is added to a table, the tool automatically runs.  I have some experience with Model Builder but not a lot with Python.  Basically I want to autosave my map and then run a tool on the .mxd itself to export it to KML.  This may not even be possible but I thought I'd ask here on GeoNet if anyone had any ideas.

 

Thanks!

0 Kudos
6 Replies
NickStrickling
New Contributor II

It is possible to create a custom tool in ArcMap that "reacts" to edits to the layer using ArcObjects.  You would tie into events which get triggered.  When these events are caught, your code can be run. 

Here is the ESRI documentation that covers events;

http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/How_to_listen_to_works...

I do not know if you can access these events using Python or the Add-In customization. 

0 Kudos
ISP_graynic
Occasional Contributor II

Thank you for the information.  I will check it out.

NickStrickling
New Contributor II

Out of curiosity, did you ever get around to solving this?

0 Kudos
ISP_graynic
Occasional Contributor II

I never figured out how to do it on changes to a layer or map, but did find out how to just have a script run at a prescribed time every day which should basically do the trick. Scheduling a Python script or model to run at a prescribed time | ArcGIS Blog

0 Kudos
NickStrickling
New Contributor II

Cool – if you can script it then it’s not worth diving into ArcObjects!  Plus the scripting is much more powerful ever sense the move to Python. 

0 Kudos
ISP_graynic
Occasional Contributor II

I have started to learn some python, at least for use in ArcGIS.  There are a lot of useful resources out there to learn python for ArcGIS and just in general.  Thanks!