<?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: Possible to run python scripts on unopened mxds? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6664#M582</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is it possible to run a pyhton script on an unopened mxd?&amp;nbsp; I was thinking of a havinga "Master" map that users could digitize polygons in and then run a tool that applied their new polygon (as a definition query) to three other mxds.&amp;nbsp; I have scripts that run individually (1 per map) and was hoping to combine them into a single tool.&amp;nbsp; Am I way off base?&amp;nbsp; Is it simply a matter of referencing the three mxds?&amp;nbsp; Thanks.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if you can edit features in the map itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can reference a map doc and print it's contents at the very least:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r'C:\Users\user\path\to\mxd.mxd')


for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.name&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you mean by &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;a tool that applied their new polygon (as a definition query) to three other mxds.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:16:53 GMT</pubDate>
    <dc:creator>KevinYanuk</dc:creator>
    <dc:date>2021-12-10T20:16:53Z</dc:date>
    <item>
      <title>Possible to run python scripts on unopened mxds?</title>
      <link>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6663#M581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to run a pyhton script on an unopened mxd?&amp;nbsp; I was thinking of a havinga "Master" map that users could digitize polygons in and then run a tool that applied their new polygon (as a definition query) to three other mxds.&amp;nbsp; I have scripts that run individually (1 per map) and was hoping to combine them into a single tool.&amp;nbsp; Am I way off base?&amp;nbsp; Is it simply a matter of referencing the three mxds?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Aug 2012 17:38:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6663#M581</guid>
      <dc:creator>AllenSmith</dc:creator>
      <dc:date>2012-08-31T17:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to run python scripts on unopened mxds?</title>
      <link>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6664#M582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is it possible to run a pyhton script on an unopened mxd?&amp;nbsp; I was thinking of a havinga "Master" map that users could digitize polygons in and then run a tool that applied their new polygon (as a definition query) to three other mxds.&amp;nbsp; I have scripts that run individually (1 per map) and was hoping to combine them into a single tool.&amp;nbsp; Am I way off base?&amp;nbsp; Is it simply a matter of referencing the three mxds?&amp;nbsp; Thanks.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if you can edit features in the map itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can reference a map doc and print it's contents at the very least:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r'C:\Users\user\path\to\mxd.mxd')


for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.name&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you mean by &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;a tool that applied their new polygon (as a definition query) to three other mxds.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:16:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6664#M582</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2021-12-10T20:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to run python scripts on unopened mxds?</title>
      <link>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6665#M583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What I was hoping to do was apply a definition query across 3 different mxds with 1 script and without opening each mxd individually.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The definition query would run a selection by location in one map, a clip process in another and a second select by location function in&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a third.&amp;nbsp; It is not possible to have a single mxd with all of this in it.&amp;nbsp; Thanks for you help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Sep 2012 12:40:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6665#M583</guid>
      <dc:creator>AllenSmith</dc:creator>
      <dc:date>2012-09-04T12:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to run python scripts on unopened mxds?</title>
      <link>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6666#M584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The definition query would run a &lt;SPAN style="text-decoration:underline;"&gt;selection by location&lt;/SPAN&gt; in one map , a &lt;SPAN style="text-decoration:underline;"&gt;clip&lt;/SPAN&gt; process in another and a second &lt;SPAN style="text-decoration:underline;"&gt;select by location&lt;/SPAN&gt; function in a third.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Definition queries don't do these things, rather they limit what is visible in a layer based on SQL 'where' clause.&amp;nbsp; Rather you want 3 different geoprocessing tools that create different output datasets.&amp;nbsp; Layers in your 3 different maps could then be 'pointed' at each of the datasets that are appropriate.&amp;nbsp; Could you lay out your problem a little more clearly?&amp;nbsp; I think this is certainly doable using arcpy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Sep 2012 13:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6666#M584</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-09-04T13:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to run python scripts on unopened mxds?</title>
      <link>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6667#M585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 3 mxds (Tract, Soils, Location).&amp;nbsp; All 3 use the same geodatabase feature class in which the user specifies a certain tract (definition query).&amp;nbsp; I have 3 separate python scripts (1 for each map).&amp;nbsp; The first map uses the definition query to zoom and display the tractt and interior polygons over aerial imagery.&amp;nbsp; The second uses the definiton query to clip a soils layer and display tabular data.&amp;nbsp; the third mxd uses the same definition query to show the general tract location as well as some intersecting data.&amp;nbsp; Currently, I have to open each map independently and run it's resepctive script.&amp;nbsp; I would like to run all 3 mxds at once, with a single button push.&amp;nbsp; T should note that the selected polygon (defintion query) needs to be temporary.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Sep 2012 14:16:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/possible-to-run-python-scripts-on-unopened-mxds/m-p/6667#M585</guid>
      <dc:creator>AllenSmith</dc:creator>
      <dc:date>2012-09-04T14:16:37Z</dc:date>
    </item>
  </channel>
</rss>

