<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating an Addin Extension that Responds to a Python Script in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264273#M6804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;At first thought, your pattern sounds like the observer pattern, notify registered observers when an event occurs, except you're using two different languages, so I'm not sure how you would connect the two.&lt;BR /&gt;&lt;BR /&gt;At second thought, there is: &lt;STRONG&gt;com.esri.arcgis.carto.IActiveViewEventsFocusMapChangedEvent&lt;/STRONG&gt;&amp;nbsp; Which might work.&lt;BR /&gt;&lt;BR /&gt;Lastly, Add-ins respond to user initiated events, so I'm not sure how you would initiate the tool, button, menu, utility object or extension that should be listening for the events from python.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestions.&amp;nbsp; I was afraid of the last thing you said.&amp;nbsp; The notification process I outlined would ensure that any user triggered refresh would cause the listener to respond, detect the update by Python from the text object, and perform its action.&amp;nbsp; A refresh is harder for a user to avoid as a trigger than pressing another button.&amp;nbsp; That approach may be my best option, but it would introduce a delay to the full completion of the update that I would rather avoid and would not be anywhere close to fully reliable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be a nice enhancement of the Python arcpy interface to have it be able to call buttons or activate tools on a toolbar, but I also see the potential dangers in allowing that.&amp;nbsp; I am at 10.0, so I know it cannot do that.&amp;nbsp; With 10.1 Python add-ins I did not hear about anything like that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without being able to pass an application object hook or map to a DLL from Python, I also do not see a way to do this from the Python side.&amp;nbsp; The hook would be required to get ArcObjects to trigger any button or toolbar I might build designed to work within an open ArcMap session.&amp;nbsp; I would wrap the script tool inside of an ArcObjects call if ArcObjects could actually trigger the tool to actually open it's dialog and continue when the dialog closes, but I have not seen anything like that either.&amp;nbsp; I also see dangers in that approach as well, since the program notification processes of the two languages would remain incompatible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not think the FocusMapChanged Event helps, since I believe that only occurs when a user opens another map, not while continuing to work within a single map.&amp;nbsp; But the help description is not very clear about its intended behavior.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Aug 2012 16:40:43 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2012-08-24T16:40:43Z</dc:date>
    <item>
      <title>Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264268#M6799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to know if it is possible to create an Add-in extension that listens for map refresh events to specifically respond to the actions of a python script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I envision adding a hidden text object into a specific kind of map that will at first indicate to the Add-in Extension that nothing needs to be done.&amp;nbsp; When the Python script runs it will write to that text object to set a flag telling the Extension that it is processing a change to the map, so ignore any map refresh actions during the script processing.&amp;nbsp; Just prior to completion of the Python script, the Python script will update the Text Object to say that it just finished and needs the Extension to do its thing.&amp;nbsp; Then the Python script will refresh the map.&amp;nbsp; I assume the Add-in Extension can detect the map refresh event triggered by the Python script, read the text object to detect that python wants the extension to run and then the extension can fire its action on the map.&amp;nbsp; When the extension finishes it will reset the text object back to the state indicating that nothing needs to be done by the extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this sound like it will work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want the Add-in to detect when arcpy.mapping finishes updating everything that it can in the map, and then have the extension change the data frame clipping geometry to match a feature's shape according to the current definition query on a layer that the python script set.&amp;nbsp; I do not want the user to have to push another button after the Python script finishes to do things that Python seemingly cannot do, and I do not want the Add-in to do the Python script actions.&amp;nbsp; I do not see any other way to have Python trigger an ArcObjects action within the currently open map, since the ctypes functionality says it is limited to basic C++ types and I do not see a way to pass a hook for the current map to an ArcObjects DLL method from Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please correct me if I am wrong about any of this or if there is a better approach to do what I want.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 23:27:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264268#M6799</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-23T23:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264269#M6800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What about that: embed your Python script into a Python script tool inside a custom toolbox. Extent your add-in with a button. If the user clicks the button, the add-in runs the script tool (synchron) and after it finished, it does the other stuff with ArcObjects. For deployment (to the assembly cache) you can add the custom toolbox as a resource to the add-in.&amp;nbsp; The code for using an embedded toolbox is something like that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Initialize the geoprocessor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; IGeoProcessor2 gp = new GeoProcessorClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Add the toolbox.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string strToolbox = strPath + "\\PythonTools.tbx";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.AddToolbox(strToolbox);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Generate the array of parameters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IVariantArray parameters = new VarArrayClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;parameters.Add(inString);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Execute the model tool by name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IGeoProcessorResult result = gp.Execute("Reply", parameters, null);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Ergebnis zurückliefern&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string reply = result.GetOutput(0).GetAsText();&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 11:10:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264269#M6800</guid>
      <dc:creator>JochenManegold</dc:creator>
      <dc:date>2012-08-24T11:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264270#M6801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What about that: embed your Python script into a Python script tool inside a custom toolbox. Extent your add-in with a button. If the user clicks the button, the add-in runs the script tool (synchron) and after it finished, it does the other stuff with ArcObjects. For deployment (to the assembly cache) you can add the custom toolbox as a resource to the add-in.&amp;nbsp; The code for using an embedded toolbox is something like that:&lt;BR /&gt;&lt;BR /&gt;// Initialize the geoprocessor.&lt;BR /&gt; IGeoProcessor2 gp = new GeoProcessorClass();&lt;BR /&gt;// Add the toolbox.&lt;BR /&gt;string strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);&lt;BR /&gt;string strToolbox = strPath + "\\PythonTools.tbx";&lt;BR /&gt;gp.AddToolbox(strToolbox);&lt;BR /&gt;// Generate the array of parameters.&lt;BR /&gt;IVariantArray parameters = new VarArrayClass();&lt;BR /&gt;parameters.Add(inString);&lt;BR /&gt;// Execute the model tool by name.&lt;BR /&gt;IGeoProcessorResult result = gp.Execute("Reply", parameters, null);&lt;BR /&gt;// Ergebnis zurückliefern&lt;BR /&gt;string reply = result.GetOutput(0).GetAsText();&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not think this will work for me.&amp;nbsp; My python script tool is unconventional and is not merely designed to act as a geoprocessing tool.&amp;nbsp; It acts like a form object with user interface capabilities.&amp;nbsp; I do not want the user to simply feed parameters to the tool.&amp;nbsp; I intend for them to interact with the tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have adapted the script tool's ToolValidator to responds to each action by the user so that as they make choices, that action changes the options that work for other parameters according to the databases the user is querying.&amp;nbsp; The interface ensures that the user ends up with inputs that will return valid results when the actual geoprocessing takes place.&amp;nbsp; For example, if a user inputs a date range, the ToolValidator reads the database to make sure that there is data that extends to both limits of the range, and corrects the range if it does not.&amp;nbsp; It also responds to the date range change by altering the list of Primary Roads that the user can choose to only be those roads that actually had events within the date range.&amp;nbsp; When the user chooses a Primary Road, the validator makes sure it is in the list, and then updates the lists of intersecting roads that connect to the chosen Primary road.&amp;nbsp; As the user chooses intersecting roads and sets offsets from that intersection that will ultimately create point events or a road segment event when the actual georocessing takes place, the interface makes sure that any offsets will remain on the road and corrects the user's entries if they do not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This interactive experience is essential to the tool's use and converting to it a mere geoprocessing tool called by ArcObjects would defeat my purpose.&amp;nbsp; I am aware that with .Net I could design a form using ArcObjects, but I have no interest in doing that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore the python script tool dialog must actually be opened by the user and only the user can determine when they are happy with the parameters values they have chosen within the dialog to trigger the actual geoprocessing actions of the tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Given my objectives and restrictions, do you still think your suggestion could somehow be adapted to work?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 15:22:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264270#M6801</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-24T15:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264271#M6802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I want to know if it is possible to create an Add-in extension that listens for map refresh events to specifically respond to the actions of a python script?&lt;BR /&gt;&lt;BR /&gt;I envision adding a hidden text object into a specific kind of map that will at first indicate to the Add-in Extension that nothing needs to be done.&amp;nbsp; When the Python script runs it will write to that text object to set a flag telling the Extension that it is processing a change to the map, so ignore any map refresh actions during the script processing.&amp;nbsp; Just prior to completion of the Python script, the Python script will update the Text Object to say that it just finished and needs the Extension to do its thing.&amp;nbsp; Then the Python script will refresh the map.&amp;nbsp; I assume the Add-in Extension can detect the map refresh event triggered by the Python script, read the text object to detect that python wants the extension to run and then the extension can fire its action on the map.&amp;nbsp; When the extension finishes it will reset the text object back to the state indicating that nothing needs to be done by the extension.&lt;BR /&gt;&lt;BR /&gt;Does this sound like it will work?&lt;BR /&gt;&lt;BR /&gt;I want the Add-in to detect when arcpy.mapping finishes updating everything that it can in the map, and then have the extension change the data frame clipping geometry to match a feature's shape according to the current definition query on a layer that the python script set.&amp;nbsp; I do not want the user to have to push another button after the Python script finishes to do things that Python seemingly cannot do, and I do not want the Add-in to do the Python script actions.&amp;nbsp; I do not see any other way to have Python trigger an ArcObjects action within the currently open map, since the ctypes functionality says it is limited to basic C++ types and I do not see a way to pass a hook for the current map to an ArcObjects DLL method from Python.&lt;BR /&gt;&lt;BR /&gt;Please correct me if I am wrong about any of this or if there is a better approach to do what I want.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At first thought, your pattern sounds like the observer pattern, notify registered observers when an event occurs, except you're using two different languages, so I'm not sure how you would connect the two.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At second thought, there is: &lt;/SPAN&gt;&lt;STRONG&gt;com.esri.arcgis.carto.IActiveViewEventsFocusMapChangedEvent&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp; Which might work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lastly, Add-ins respond to user initiated events, so I'm not sure how you would initiate the tool, button, menu, utility object or extension that should be listening for the events from python.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 16:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264271#M6802</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-24T16:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264272#M6803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;My python script tool is unconventional and is not merely designed to&amp;nbsp; act as a geoprocessing tool.&amp;nbsp; It acts like a form object with user&amp;nbsp; interface capabilities.&amp;nbsp; I do not want the user to simply feed&amp;nbsp; parameters to the tool.&amp;nbsp; I intend for them to interact with the tool.&amp;nbsp; I am aware that with .Net I could design a form using ArcObjects, but I have no interest in doing that.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Can I interest you in writing a Java add-in?&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 16:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264272#M6803</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-24T16:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264273#M6804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;At first thought, your pattern sounds like the observer pattern, notify registered observers when an event occurs, except you're using two different languages, so I'm not sure how you would connect the two.&lt;BR /&gt;&lt;BR /&gt;At second thought, there is: &lt;STRONG&gt;com.esri.arcgis.carto.IActiveViewEventsFocusMapChangedEvent&lt;/STRONG&gt;&amp;nbsp; Which might work.&lt;BR /&gt;&lt;BR /&gt;Lastly, Add-ins respond to user initiated events, so I'm not sure how you would initiate the tool, button, menu, utility object or extension that should be listening for the events from python.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestions.&amp;nbsp; I was afraid of the last thing you said.&amp;nbsp; The notification process I outlined would ensure that any user triggered refresh would cause the listener to respond, detect the update by Python from the text object, and perform its action.&amp;nbsp; A refresh is harder for a user to avoid as a trigger than pressing another button.&amp;nbsp; That approach may be my best option, but it would introduce a delay to the full completion of the update that I would rather avoid and would not be anywhere close to fully reliable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be a nice enhancement of the Python arcpy interface to have it be able to call buttons or activate tools on a toolbar, but I also see the potential dangers in allowing that.&amp;nbsp; I am at 10.0, so I know it cannot do that.&amp;nbsp; With 10.1 Python add-ins I did not hear about anything like that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without being able to pass an application object hook or map to a DLL from Python, I also do not see a way to do this from the Python side.&amp;nbsp; The hook would be required to get ArcObjects to trigger any button or toolbar I might build designed to work within an open ArcMap session.&amp;nbsp; I would wrap the script tool inside of an ArcObjects call if ArcObjects could actually trigger the tool to actually open it's dialog and continue when the dialog closes, but I have not seen anything like that either.&amp;nbsp; I also see dangers in that approach as well, since the program notification processes of the two languages would remain incompatible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not think the FocusMapChanged Event helps, since I believe that only occurs when a user opens another map, not while continuing to work within a single map.&amp;nbsp; But the help description is not very clear about its intended behavior.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 16:40:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264273#M6804</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-24T16:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264274#M6805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What if you wrote a console ArcObjects application that you execute from python?&amp;nbsp; I believe you can get a list of current ArcMap application references from the IAppROT interface.&amp;nbsp; That might work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 16:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264274#M6805</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-24T16:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264275#M6806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can I interest you in writing a Java add-in?&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sarcasm aside, the python script tool dialog is doing the essential things that a form in ArcObjects does, in that it listens to actions done on the form and allows me to respond.&amp;nbsp; The debug time of validating user input on an ArcObjects form is nearly unending when text boxes have to take care of virtually everything and I have to write all of the validation code to restrict it to providing valid dates, numbers, and combobox lists, or knowing when to cross check each interface object at precisely the right moment during an onchange event for each interface object, etc.&amp;nbsp; Interface design in ArcObjects is full of undocumented pitfalls that have wasted weeks of my time that I simply don't have to deal with on the script tool form.&amp;nbsp; I am utterly tired of ArcObjects expecting me to take control of everything rather than being able to rely on well designed built-in code that takes care of at least 50% of my validation needs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:11:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264275#M6806</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-24T17:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264276#M6807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In .NET maybe it is hard to capture every possible user "oops".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In Java, it's straight-forward.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DecimalFormat.. DateFormat..&amp;nbsp; fun stuff.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you enter junk into this text field, it will default to 0.00&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an instance of DecimalFormat to limit the number of integers the user can type into certain fields.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DecimalFormat temperatureFormat = new DecimalFormat("##0.00");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(temperatureFormat),new NumberFormatter(temperatureFormat),new NumberFormatter(temperatureFormat)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.addFocusListener(new FocusAdapter() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void focusGained(FocusEvent e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SwingUtilities.invokeLater(new Runnable(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void run() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.selectAll();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.setBounds(120, 8, 85, 20);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; panel.add(ftfTemperature);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:56:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264276#M6807</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2021-12-11T12:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264277#M6808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What if you wrote a console ArcObjects application that you execute from python?&amp;nbsp; I believe you can get a list of current ArcMap application references from the IAppROT interface.&amp;nbsp; That might work.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The IAppROT interface seems promising for connecting to any running ESRI application.&amp;nbsp; Hopefully I could have Python send a text string naming the Map and test that string against the IAppROT list of running applications (realizing that only ArcMap applications would be valid).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the help on the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/AppRefClass_Class/002300000006000000/"&gt;AppRef&lt;/A&gt;&lt;SPAN&gt; returned by the Item method of IAppROT, it says "Note you can only use the AppRef object if your code is running inside one of the ArcGIS application processes".&amp;nbsp; I assume a console ArcObjects application would meet that requirement, but I have not designed one before, so I am not sure.&amp;nbsp; In any case, so far this looks like a viable option.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:26:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264277#M6808</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-24T17:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264278#M6809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In .NET maybe it is hard to capture every possible user "oops".&lt;BR /&gt;&lt;BR /&gt;In Java, it's straight-forward.&lt;BR /&gt;&lt;BR /&gt;DecimalFormat.. DateFormat..&amp;nbsp; fun stuff.&lt;BR /&gt;&lt;BR /&gt;If you enter junk into this text field, it will default to 0.00&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an instance of DecimalFormat to limit the number of integers the user can type into certain fields.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DecimalFormat temperatureFormat = new DecimalFormat("##0.00");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(temperatureFormat),new NumberFormatter(temperatureFormat),new NumberFormatter(temperatureFormat)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.addFocusListener(new FocusAdapter() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void focusGained(FocusEvent e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SwingUtilities.invokeLater(new Runnable(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void run() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.selectAll();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.setBounds(120, 8, 85, 20);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; panel.add(ftfTemperature);
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lines of Python code to restrict a script tool field to a long = None: Define the input as a Long in the parameter dialog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lines of Python code to restrict a script tool field to a date = None: Define the input as a Date in the parameter dialog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hard to get any simpler than that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I have no background in using Java I can't say the code above gives me confidence that I could easily convert what I have done to a Java add-in, but I will start looking into that as another option.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:56:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264278#M6809</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T12:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264279#M6810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This prints the title of the only mxd open on my machine, index = 0.&amp;nbsp; You would probably have to make sure you have the right mxd application name by iterating over the count of open mxds and getting the title.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
public class Console {

&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EngineInitializer.initializeEngine();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initializeArcGISLicenses();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IAppROT aprot = new AppROT();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication application = aprot.getItem(0);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(application.getDocument().getTitle());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (UnknownHostException e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; static void initializeArcGISLicenses() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; com.esri.arcgis.system.AoInitialize ao = new com.esri.arcgis.system.AoInitialize();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ao.isProductCodeAvailable(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeArcView) == com.esri.arcgis.system.esriLicenseStatus.esriLicenseAvailable)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeArcView);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Exception e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:56:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264279#M6810</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2021-12-11T12:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264280#M6811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Lines of Python code to restrict a script tool field to a long: Define the input as a Long.&lt;BR /&gt;Lines of Python code to restrict a script tool field to a date: Define the input as a Date.&lt;BR /&gt;&lt;BR /&gt;Hard to get any simpler than that.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;True.&amp;nbsp; Got me there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:42:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264280#M6811</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-24T17:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264281#M6812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This prints the title of the only mxd open on my machine, index = 0.&amp;nbsp; You would probably have to make sure you have the right mxd application name by iterating over the count of open mxds and getting the title.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
public class Console {

&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EngineInitializer.initializeEngine();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initializeArcGISLicenses();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IAppROT aprot = new AppROT();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication application = aprot.getItem(0);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(application.getDocument().getTitle());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (UnknownHostException e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; static void initializeArcGISLicenses() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; com.esri.arcgis.system.AoInitialize ao = new com.esri.arcgis.system.AoInitialize();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ao.isProductCodeAvailable(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeArcView) == com.esri.arcgis.system.esriLicenseStatus.esriLicenseAvailable)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeArcView);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Exception e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you know how to call this console application from the Python side and have Python provide a parameter?&amp;nbsp; Would the Python ctypes interface be the way to go?&amp;nbsp; If so then this seems to have everything I would need to chain the two together and from there could decide what I wanted Python to do and what I wanted the console application to do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:56:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264281#M6812</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T12:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264282#M6813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Doesn't python have an OS module that you can call?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;os.system(your application, your parameter)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 19:20:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264282#M6813</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-24T19:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264283#M6814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Doesn't python have an OS module that you can call?&lt;BR /&gt;&lt;BR /&gt;os.system(your application, your parameter)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is now answered and the solution is much better than my original idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the method below I can now create a Python script that calls an ArcMap Console Application and that passes an argument with a name of the map that Python wants the Console Application to update.&amp;nbsp; The Console Application is able use the IAppROT interface to get an application hook to the Map that Python wants updated and can then do things using ArcObjects code that arcpy mapping cannot do.&amp;nbsp; Python can pass as many additonal standard C type (char, int, date, etc.) arguments that the Console Application may need to coordinate its actions with the Python script.&amp;nbsp; I am fairly certain that the Console application can pass back a result to Python using the method outlined below as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, there is no need to wait on the user to do anything to coordinate the triggering of the code, or to use an Add-in extension event listener, or store notification text objects in the map to handle communications between Python and ArcObjects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Python subprocess.check_call method works for calling an ArcMap Desktop Console Application with arguments in this format:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from subprocess import check_call
check_call(["DesktopConsoleApplication1.exe", "Collision_Segment_Diagram2.mxd"])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following ArcMap Desktop Console Application code worked to notify me whether or not a map is open and whether or not it matches the title python passed as an agrument to the console application:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Framework;

namespace DesktopConsoleApplication1
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; class Program
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static LicenseInitializer m_AOLicenseInitializer = new DesktopConsoleApplication1.LicenseInitializer();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [STAThread()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //ESRI License Initializer generated code.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeArcView, esriLicenseProductCode.esriLicenseProductCodeArcEditor, esriLicenseProductCode.esriLicenseProductCodeArcInfo },
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new esriLicenseExtensionCode[] { });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //ESRI License Initializer generated code.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IAppROT aprot = new AppROT();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication application = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int a = 0; a &amp;lt; aprot.Count; a++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; application = aprot.get_Item(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine("Application Title = " + application.Document.Title);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string curItem in args)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine("Args: " + curItem);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (application.Document.Title == curItem)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine("The map was found!&amp;nbsp; Do something!");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine("The open map does not match that title.");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (aprot.Count == 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine("No ArcMap application is open");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //System.Console.ReadLine();&amp;nbsp; //Uncomment this line if you want to have the console pause before closing.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("{0} Exception caught.", e);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Do not make any call to ArcObjects after ShutDownApplication()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_AOLicenseInitializer.ShutdownApplication();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264283#M6814</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T12:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264284#M6815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I spoke too soon. While the script and console application work perfectly when I run the Python script from Idle, it hangs when I run the same code from within a script tool. The Console application window opens, but the parameters never get read when the script tool runs the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, I know how to get the Data Frame Clip Geometry updated from the ArcObjects side, but I still need to find a way to connect it automatically to the Python code at runtime.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the parameters are all that is hanging it up, I may be able to eliminate the need for any parameters on the Console application by using the original technique I suggested of using an intermediate text object for passing parameter information between Python and ArcObjects.&amp;nbsp; That would be acceptable for my needs.&amp;nbsp; However, I will have to do additional testing to be certain that the Console application will run from a script tool and not hang if parameters are eliminated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It hangs without parameters as well from a script tool.&amp;nbsp; Now I am looking at the subprocess options to see if it can create a shell that works within the script tool, but I am not optimistic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The shell option causes an error and using call instead of check_call hangs also.&amp;nbsp; So it looks like a script tool does not work with a Console application at all.&amp;nbsp; Bummer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Aug 2012 00:10:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264284#M6815</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-26T00:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264285#M6816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In .NET maybe it is hard to capture every possible user "oops".&lt;BR /&gt;&lt;BR /&gt;In Java, it's straight-forward.&lt;BR /&gt;&lt;BR /&gt;DecimalFormat.. DateFormat..&amp;nbsp; fun stuff.&lt;BR /&gt;&lt;BR /&gt;If you enter junk into this text field, it will default to 0.00&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an instance of DecimalFormat to limit the number of integers the user can type into certain fields.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DecimalFormat temperatureFormat = new DecimalFormat("##0.00");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(temperatureFormat),new NumberFormatter(temperatureFormat),new NumberFormatter(temperatureFormat)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.addFocusListener(new FocusAdapter() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void focusGained(FocusEvent e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SwingUtilities.invokeLater(new Runnable(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void run() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.selectAll();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftfTemperature.setBounds(120, 8, 85, 20);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; panel.add(ftfTemperature);
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Leo:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you screen shot what this code actually produces as far as an interface that the user would see?&amp;nbsp; Searching help on Java Add-ins has left me completely in the dark on what this code would end up looking like or how it launches or anything.&amp;nbsp; Is the Java IDE environment text based only for defining the form or does it have visual drag and drop tools?&amp;nbsp; I need the real basics to get oriented to decide if I want to even attempt to go down this path.&amp;nbsp; How is building a Java add-in any different from building a .Net add-in?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:57:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264285#M6816</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T12:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264286#M6817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have decided to give my original idea a try and set up a listener for the AfterDraw event in an Add-in extension.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even though Python's refresh of an ActiveView does not seem to trigger the extension code, it appears that this approach will work because the mere act of closing the geoprocessing results window when the script is done triggers the extension code to detect an AfterDraw event if that dialog covered any portion of the map.&amp;nbsp; This behavior should be nearly unavoidable.&amp;nbsp; Even if closing that tool dialog does not work, if anything covers a portion of the map for even a moment, like a messagebox or a dockable window expansion, the code is triggered and should be able to evaluate the map configuration to determine if it needs to execute its custom code.&amp;nbsp; And failing all of that if any other user action triggers a refresh the code will fire.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point I mainly need to identify the optimum code sequence to ensure that the AfterDraw event always fires in connection with the proper ActiveView (the LayoutView) and that it quickly determines when it does or does not need to implement its custom behavior.&amp;nbsp; The map must be in Layout view because the Python code I have written ensures this is the view when it finishes running, and if that is the case it should then determine if the Text object exists in the map, and if that is the case it should detect if the Text object has the proper information for executing the code.&amp;nbsp; If there are any suggestions on how to best optimize such code, I would appreciate them.&amp;nbsp; I will continue experimenting in the meantime.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 00:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264286#M6817</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-27T00:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Addin Extension that Responds to a Python Script</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264287#M6818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Leo:&lt;BR /&gt;Could you screen shot what this code actually produces as far as an interface that the user would see?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Weather screenshot is attached.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Searching help on Java Add-ins has&amp;nbsp; left me completely in the dark on what this code would end up looking&amp;nbsp; like or how it launches or anything. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is not Java "Add-in" code.&amp;nbsp; It is Java Swing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is the Java IDE environment text&amp;nbsp; based only for defining the form or does it have visual drag and drop&amp;nbsp; tools?&amp;nbsp; I need the real basics to get oriented to decide if I want to&amp;nbsp; even attempt to go down this path.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;It has visual drag and drop.&amp;nbsp; I'm running Eclipse 3.7.1&amp;nbsp; See ide screenshot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How is building a Java add-in any&amp;nbsp; different from building a .Net add-in?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I was about to dabble in building a .NET add-in over the weekend to answer that question for myself.&amp;nbsp; Aside from the obvious IDE configuration differences and language patterns, add-ins should be relatively the same.&amp;nbsp; I think the ArcObjects API still favors COM when it comes to GUI development, and that is based on my experience with displaying Java Dialogs to the end user of Add-ins within ArcMap, specifically JOptionPane.&amp;nbsp; I will say that my specific issue with JOptionPane is partly due to the JRE living on top of a COM operating system.&amp;nbsp; I've seen the C#.NET Visual Studio Express IDE enough to know that switching from Java to C# using Visual Studio Express would be a pain getting used to the way you work with the add-in config.xml file and the way you refactor, and then there is all of the fun Windows issues still looming about in .NET when it comes to registering dlls.&amp;nbsp; But anything you learn for the first time sticks with you as the "easy way".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 15:47:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-an-addin-extension-that-responds-to-a/m-p/264287#M6818</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-27T15:47:54Z</dc:date>
    </item>
  </channel>
</rss>

