<?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: Open mxd with python add-in? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621923#M48417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is what i've tried so far (as an application extension addin), but it's not working.&amp;nbsp; I also tried it without the open._doc_ bit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import pythonaddins&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;class Verbandsgebiet(object):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for Verbandsgebiet_addin.add (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;&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;&amp;nbsp; self.enabled = True&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp; mxd = arcpy.mapping.MapDocument(r"E:\Programme\ArcGIS\Desktop 10.2\Templates\mymxd.mxd")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open.__doc__(mxd)&lt;BR /&gt;return&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Aug 2014 13:35:06 GMT</pubDate>
    <dc:creator>TrilliumLevine1</dc:creator>
    <dc:date>2014-08-27T13:35:06Z</dc:date>
    <item>
      <title>Open mxd with python add-in?</title>
      <link>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621922#M48416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems like it should be easy, but for some reason I can't figure it out.&amp;nbsp; Is there a way to implement a python add-in that runs on Arcmap startup that opens a specific mxd, as opposed to an empty one?&amp;nbsp; I know you can do lots of different things on startup with addins, but I haven't been able to find anything at all on simply running one that opens a specific mxd.&amp;nbsp; Any feedback would be appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 12:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621922#M48416</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-08-27T12:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Open mxd with python add-in?</title>
      <link>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621923#M48417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is what i've tried so far (as an application extension addin), but it's not working.&amp;nbsp; I also tried it without the open._doc_ bit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import pythonaddins&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;class Verbandsgebiet(object):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for Verbandsgebiet_addin.add (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;&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;&amp;nbsp; self.enabled = True&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp; mxd = arcpy.mapping.MapDocument(r"E:\Programme\ArcGIS\Desktop 10.2\Templates\mymxd.mxd")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; open.__doc__(mxd)&lt;BR /&gt;return&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 13:35:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621923#M48417</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-08-27T13:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Open mxd with python add-in?</title>
      <link>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621924#M48418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The responses &lt;A _jive_internal="true" href="https://community.esri.com/thread/19950"&gt;in this thread&lt;/A&gt; will be useful. You can't directly modify the current MXD, but if you're OK with opening a new session, you can do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14091508912955358" jivemacro_uid="_14091508912955358" modifiedtitle="true"&gt;
&lt;P&gt;os.startfile(mxd_path)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do this, you won't need to use the arcpy.mapping call, just point it at the actual path of your MXD file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 14:49:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621924#M48418</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2014-08-27T14:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Open mxd with python add-in?</title>
      <link>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621925#M48419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Shaun, I'll check that thread out and see what shakes out...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 15:03:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621925#M48419</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-08-27T15:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Open mxd with python add-in?</title>
      <link>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621926#M48420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, so i tried the os.startfile(mxd_path) bit within the extension add-in, and the result is that two instances of Arc always open -- a blank mxd and then mxd_path.&amp;nbsp; Another problem is that multiple instances of mxd_path open, seemingly without end.&amp;nbsp; I actually have to shut the machine down to get it to stop opening instances of mxd_path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my add-in code currently looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import pythonaddins&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;class ExtensionClass1(object):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for mxd_addin.extension2 (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;&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;&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;&amp;nbsp; os.startfile('mxd_path)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 07:13:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/open-mxd-with-python-add-in/m-p/621926#M48420</guid>
      <dc:creator>TrilliumLevine1</dc:creator>
      <dc:date>2014-08-28T07:13:23Z</dc:date>
    </item>
  </channel>
</rss>

