The ArcPad Team Blog

Unofficial stuff from the team behind the World's leading mobile GIS platform

Wednesday, November 16, 2011

ArcPad and Python

As of ArcPad 10.0.3, the Windows (Desktop/Tablet) version now supports the Python (2.6) scripting language in addition to vbScript and Jscript. There is a port of Python to windows Mobile, you might want to try PythonCE - but do so at your own risk as it is not an "official" port.
  1. You can now write your applets and customizations in python and take advantage of many of the extra libraries that are available to Python users.
  2. Supports the ArcGIS implementation of ArcPy.
    • If you have ArcGIS installed on the same PC as ArcPad they are already there, or
    • Using ArcPad in conjunction with an ArcGIS Runtime license (I currently have this on my laptop).
It is important to note that this does not expose the ArcPad object model to be used in python scripts out side of ArcPad, in case you were thinking you could create ArcPad batch files.

Over the years many people have asked for more "analytical tools" for ArcPad, so now here is a method of accessing all of those lovely jubbly geoprocessing tools that you have all come to care for so dearly.

There is an applet posted on the ArcPad Resources Site that covers the two scenarios mentioned above - ArcPad Python Applet

There are some subtle differences in writing for python with ArcPad:

  • You must capitalize objects, methods and Events: Console.Print(Map.Layers.Count)
  • You must use the full path to the message box: Application.MessageBox("ArcPad Rocks!")
  • If you want to change the style of the message box you must use the index number of the MessageBox constant not the name:  Application.MessageBox("ArcPad Rocks!", 0) instead of  Application.MessageBox("ArcPad Rocks!", apOkOnly)
So now you have another scripting language choice moving forward when customizing ArcPad to fit your data collection/editing workflows.