It is documented in several different places. The place to start is the GEDitCOM II help itself, which you get by using the commands in the "Help" menu while running GEDitCOM II. Expand the "Scripting" section in the help window and read the chapter on "Writing Python and Ruby Scripts." All the scripting commands are in a separate help topic. The commands are defined for use in Apple Script, but each one lists the format needed to use it with Python.
This help does not include all you need. Details on properties of all the objects accessible to scripts are stored in the scripting Dictionary of GEDitCOM II. To access this dictionary, you have to run Apple's Script Editor (which is available in all MacOS's). When it is running, use its "Open Dictionary..." menu command and open the GEDitCOM II dictionary. This dictionary is a standard form for Apple Scripting documentation, but all objects available to Apple Scripts are available to Python scripts too. Now that I know Python better, I like it much better that Apple Script for scripting GEDitCOM II.
The object properties in the dictionary often have a slightly different form then when used in Python. This difference is caused by Apple's scripting bridge. It changes names of properties that contain blanks. It removes blanks and capitalizes first letter of next block (or does nothing if already capital). Under family records in the GEDitCOM II suite, you will find "marriage SDN" which becomes "marriageSDN" in python. It is defined there as
marriage SDN (integer, r/o) - Minimum marriage date as serial day number (0 if no date or invalid date) (since 1.3)
Serial day number assigns numbers to dates and are much better when doing date calculations. If you what date text, you can use "marriage date" or "marriage date user" (which become marriageDate or marriageDateUser in python). These and all other properties are defined in the dictionary.
These dictionaries are the way all scriptable programs work (by Apple Script mostly, but also by python or ruby). The content is very brief (limited by dictionary format), but you can usually find what you need. The worst case I saw was about 500 pages of properties for Microsoft Word. It took a long time to find what I needed when I wrote a script for GEDitCOM II that would output results to a Word document, and many of properties didn't work as claimed. I think the GEDitCOM II Dictionary is much better than that and all the properties work.
When using python, the GEDitCOM II module can be a big help. I just added this to GEDitCOM II recently and I use it for all my python scripts. It has nothing you could not do in a stand alone script, but it has lots of tasks I have needed often. I add new things as I find common elements. I am sure I will find more in the future. It is by no means exhaustive, which means it is good to know how those things are done without relying on the module for all tasks. The module is defined in an on-line tutorial:
It describes most (but not all) the methods in the module. GetIndividual(), for example, just gets a reference to the individual selected in the front widow. You can provide an optional text prompt parameter. If no individual is selected, the user will be prompted to select an individual from a list using the provided prompt. Once you have the reference, you can access all the individual properties defined in the dictionary. Also note that individual is a subclass of gedcom record, so you can access parent class properties as well (as goes for many objects in the GEDitCOM II hierarchy of objects).
Once you know more about scripting, it might be helpful to look at some of the module methods in their source code to see how they work. Before the module, all scripts had that code instead. for those common tasks.
Hope that helps.
On Jul 3, 2011, at 4:25 AM, bwbecker wrote:
John Nairn http://www.geditcom.com
Genealogy Software for the Mac