<?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: openDocument (self) not firing in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722854#M55989</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate the help. Missed step 6 which seems obvious in hindsight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Oct 2015 16:11:06 GMT</pubDate>
    <dc:creator>ShaunConway</dc:creator>
    <dc:date>2015-10-22T16:11:06Z</dc:date>
    <item>
      <title>openDocument (self) not firing</title>
      <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722852#M55987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a python add-in using the python add-in assistant. The add-in included a class for triggering the &lt;STRONG&gt;openDocument&lt;/STRONG&gt; (&lt;SPAN class="arcpyref"&gt;self&lt;/SPAN&gt;) event. However, it never fires. I dumbed down the method to only include a pythonaddin.messagebox statement, with no luck at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the same approach, but with the &lt;STRONG&gt;startup&lt;/STRONG&gt;(&lt;SPAN class="arcpyref"&gt;self&lt;/SPAN&gt;) event, it works great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried adding a delay using time.sleep without any success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using ArcGIS 10.2.2, windows 7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Oct 2015 20:54:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722852#M55987</guid>
      <dc:creator>ShaunConway</dc:creator>
      <dc:date>2015-10-21T20:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: openDocument (self) not firing</title>
      <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722853#M55988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm it seems to work for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.) Created add-in using Python add-in assistent. One Extension with openDocument selected.&lt;/P&gt;&lt;P&gt;2.) Changed openDocument method to:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def openDocument(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pythonaddins.MessageBox('This is a message box!', 'INFO', 0)&lt;/PRE&gt;&lt;P&gt;3.) Save add-in script and run makeaddin.py&lt;/P&gt;&lt;P&gt;4.) Run .esriaddin file to install&lt;/P&gt;&lt;P&gt;5.) Open ArcMap&lt;/P&gt;&lt;P&gt;6.) Enable new extension&lt;/P&gt;&lt;P&gt;7.) Open Python window&lt;/P&gt;&lt;P&gt;8.) Load a map document&lt;/P&gt;&lt;P&gt;9.) Message box appears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This only fires when a document is opened, not on ArcMap startup, unless you open an mxd at (approximately) the same time as startup (e.g. double-click an mxd outside ArcMap).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722853#M55988</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T06:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: openDocument (self) not firing</title>
      <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722854#M55989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate the help. Missed step 6 which seems obvious in hindsight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2015 16:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722854#M55989</guid>
      <dc:creator>ShaunConway</dc:creator>
      <dc:date>2015-10-22T16:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: openDocument (self) not firing</title>
      <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722855#M55990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In step 6 what are you enabling? This is not an option in the Add In Manager, Customize - Extensions, etc. I have the same problem. I'm running a simple message box and it does nothing. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2016 22:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722855#M55990</guid>
      <dc:creator>danashney</dc:creator>
      <dc:date>2016-11-02T22:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: openDocument (self) not firing</title>
      <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722856#M55991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you've successfully created the extension add-in, it should appear in the extension list. Step six enables the extension, similar to enabling Spatial Analyst, 3D Analyst, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2016 23:54:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722856#M55991</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-11-02T23:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: openDocument (self) not firing</title>
      <link>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722857#M55992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Darren.&lt;/P&gt;&lt;P&gt;&amp;nbsp;I run the .esriaddin file to install this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Add in shows up in the Add Ins Manager but it does not exist in Extensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code. It works just fine in the ArcMap immediate window. Time delay is there as I have seen other postings where people mentioned things may not run on the startup method if ArcMap has not fully loaded. This has been pretty frustrating as testing has consisted of run it, nothing happens so start guessing. Any feedback is greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import pythonaddins&lt;BR /&gt;import time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class messagebox(object):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;"""Implementation for MsgBox_addin.messagebox (Extension)"""&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;def __init__(self):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# For performance considerations, please remove all unused methods in this class.&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.enabled = True&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;def startup(self):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;time.sleep(15)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return pythonaddins.MessageBox("fake fake fake", "TEST", 0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 15:21:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/opendocument-self-not-firing/m-p/722857#M55992</guid>
      <dc:creator>danashney</dc:creator>
      <dc:date>2016-11-03T15:21:41Z</dc:date>
    </item>
  </channel>
</rss>

