Select to view content in your preferred language

Map.Start startup script

4896
7
Jump to solution
04-28-2016 01:52 PM
JohnBonifas1
Deactivated User

...I've googled all over and can't find any info on this...where is there a tutorial on where to place this file, so that ArcMap will see it. Thanx.

0 Kudos
1 Solution

Accepted Solutions
JohnBonifas1
Deactivated User
0 Kudos
7 Replies
RebeccaStrauch__GISP
MVP Emeritus

John, are you trying to access this programatically, and if so, what development software are you trying to use?

Are you trying to find it based on the ArcMap Options dialog?

My guess is it is buried somewhere in the C:\Users\<user>\AppData\Roaming\ESRI\Desktop10.3\ArcMap\Templates\Normal.mxt   file, but that is only a guess.  I was not able to change the value in the above dialog.

A search of the registry shows it

So that my give a clue on how to modify or control it, but again, a guess, either is it embedded in the normal.mxt, OR it just ignores is unless it finds the file in the C:\Program Files (x86)\ArcGIS\Desktop10.3\MapTemplates     folder.

I would try putting a new Map.Start file in that folder and see what happens.  (I would try it, but no time right now...and don't really know what would go into the file.)

If this is not what you are going for, please supply additional info re: the version of ArcMap and the development environment you are using.  That will help others focus on what you are asking and you may get more responses.

JohnBonifas1
Deactivated User

...A ProgID is short for "Programmatic ID". It is usually an identifier for a COM/ActiveX top-level object that can be accessed using Visual Basic for Applications (VBA) or VBscript.

I did a search through my CLSIDs, and couldn't find a ProgID called "Map.Start".

Then I found this article:

ArcObjects 10 .NET SDK Help: the IStartupDialog Interface

...According to this article, the developer writes a .NET class that ArcMap will then look for and use upon startup. In Visual Studio, if you compile a project called "Map" and a class called "Start", and put it in the right place, ArcMap by default will look for and use that class upon startup. But by changing that registry entry you could call your project and class anything you want. That's why I didn't find a ProgID called "Map.Start" in my registry.

...But all of this is moot, because as of ArcGIS version 4, VBA will be deprecated in favor of Python. That's why this question is not important, and why I will not get any other replies for it.

But thanx for your help anyways. I was curious about it.

0 Kudos
JohnBonifas1
Deactivated User
0 Kudos
DanPatterson_Retired
MVP Emeritus

Specifically, it is in the MapDocument class

MapDocument—Help | ArcGIS for Desktop

A complete listing or classes and function can be found in their respective links

Alphabetical list of arcpy.mapping classes—Help | ArcGIS for Desktop

Alphabetical list of arcpy.mapping functions—Help | ArcGIS for Desktop

But it is just easier to bookmark the top of the mapping tree for ArcMap and for those about to transition, check out  arcpy.mp, the replacement for arcpy.mapping

Introduction to arcpy.mapping ...  ArcGIS for Desktop  (aka ArcMap

Introduction to arcpy.mp ...  ArcGIS PRO

0 Kudos
JohnBonifas1
Deactivated User

arcpy.mp is not included in my arcGIS 10.3 environment. I tried it in the

Python console; it came back "no module named mp".

0 Kudos
DanPatterson_Retired
MVP Emeritus

mp is for Pro

mapping is for ArcMap

as given in my last 2 links

RebeccaStrauch__GISP
MVP Emeritus

Are you just looking for..

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")

ive been routinely running custom Python scripts within ArcMap, and wanting to add list of layers to the open map document. I use

try:

  mxd = arcpy.mapping.MapDocument("CURRENT")

except RuntimeError:

  print("not in ArcMap")

else:

  df = arcpy.mapping.ListDataFrames(mxd)[0]

  newLayer = arcpy.mapping.layer("mynewlayer")

  arcpy.mapping.AddLayer(df, newLayer, ("TOP")

...sometimes I loop thru a list of layers...checking to make sure they exists first, then add them.

sorry about not formatting the above correctly (i.e. Not highlighted as Python code).  Not able to do it on current device.

thought I would add this info, but since you marked you own answer as correct, I'm assuming this is no longer an open thread.

0 Kudos