Batch Convert MXDs To Previous Version ( The Power Of Phyton Part 3)

A friend just asked me to help her dealing with some ArcGIS 10.2 MXDs while she currently only has access to ArcGIS 10.1, and yes her ArcMap wouldnt open the MXDs. Version differences sure could be real pain in the ass if you are working in multi environment map making. So make sure you are using newest version available in the market (no need to waiting for the crack because "the good guy" ESRI is so kind to give us, literally, 2 months trial, but, actually it is a lifetime trial if you are evil enough to figure out the way).

The conversion method is pretty easy and straightforward (even elementary student can do it). But, it will be at different level if you got a bunch of MXDs stored in a bunch of folders, and you need to convert it all. How will you do it? doing it one by one is a disaster man.You will eventually losing precious time while you could use it to go date with some girls out there. 

Fortunately, we got phyton which proven to be life saver at difficult times, so you can keep asking .out girls around and at same time maintain your boss to keep happy with your passionate works. 

I just make this short, so just throw your words in the comments box if you find something wrong.

1. Copy Paste this script below into notepad and save using "*.py" extension.

 import arcpy, sys, os, string   
 mxdList = string.split(arcpy.GetParameterAsText(0), ";")   
 outloc = arcpy.GetParameterAsText(1)  
 version = arcpy.GetParameterAsText(2)  
 suffix = "_"+ version.replace(".", "")  
 for item in mxdList:   
      item = item.strip('\'')   
      mxd = arcpy.mapping.MapDocument(item)   
      base = os.path.basename(item)   
      base = os.path.splitext(base)[0] + suffix + os.path.splitext(base)[1]   
      mxd.saveACopy(outloc + os.sep + base, version)  
      arcpy.AddMessage(os.path.basename(item) + " has been converted")  

2. Open ArcMap, Create A Toolbox anywhere you want, then left click on it, select Add>Script. Add script menu will appears. Fill up name, column, and other sections then click next. 















3. Browse to the script file at step 1, click Next,



4. You will make three parameters in this step, Input MXD, Output Folder, and Output MXD Version. Set it up As follows. You must manually write version values at Output Version Value List Editing.





5. Run the tool, below is an example.






Comments

Popular posts from this blog

TUTORIAL ORTHOREKTIFIKASI CITRA SATELIT RESOLUSI SEDANG (CITRA ASTER)

HAE (Height Above Ellipsoid) and MSL (Mean Sea Level) Conversion Using Pathfinder Office

Split By Attributes di ArcGIS