Dictionary of Internal Scripting Objects

Internal scripts work with objects internal to GEDitCOM II and with some special objects available only to internal scripts. This page documents all possible objects. See the sections on Object Attributes and Object Properties to learn about options available to objects and how to access or change them. The possible objects are in the following list. Each object type lists their attributes, properties, and supported commands in alphabetical order.

Note that when writing AppleScripts or Python scripts, one often refers to the AppleScript dictionary for GEDitCOM II that you can open with Apple's ScriptEditor application. This page replaces that dictionary for Internal Scripts. Many of the items are the same, but some are described more fully here and all are given by the format used in internal scripts. Internal Scripts also have many object options not easily available to AppleScripts or Python scripts.

Object Attributes

Objects, which are instances of a certain class type, are defined in Internal Scripts using object names and those names can be used get object attributes and to get and set object properties. Unless otherwise stated, all attributes and properties are available in GEDitCOM II, 3.0, build 2 or GEDitCOM 1.0; those that differ are indicated with "(since x.y/a.b)" where "x.y" is the "GEDitCOM II" version needed and "a.b" is the "GEDitCOM" version needed. The attribute styles, which are common to all object types, are as follows:

To-many object lists
Objects many be connected to a list of other objects. To get one of these lists, use an object assignment or a get command. For example
@indis = "gdoc.individuals"
gdoc.get indis,"individuals"
gets a list of individuals in a document (with object name gdoc) and assigns object name indis to the list. Lists returned by to-many relations will either be a GC List or an Internal Scripting list. The returned result will always be a list and it will be an empty list if the object does not have any of the requested objects. You can check the length of any list with @indis.count You can refer to information on objects to learn how to access objects in these lists.
    Note that a returned GC List is the actual list being used by GEDitCOM II, and not a copy. If the items in that list are deleted or get reordered due to some commands in your script, the list in the script will change as well. To avoid unexpected changes in such a list, you can make a copy as follows:
@indis = "gdoc.individuals"
CreateList recs
recs.addList indis
The resulting list in recs then has a copy of all individual records that will remain constant while running the script.
    "To-many object lists" are currently not settable.
To single objects
Objects may be connected to one type of object. To get one of these objects, use an object assignment or a get command. If any "to-single" object is not found, both methods will return a special None object that can the checked using the ifDef or ifNDef commands or by the class of the returned object. For example, if indi is an individual, you can check for the father record with:
@indi = "indi.father"             ! or use indi.get fath,"father"
ifDef fath
  ! work with father record in fath
endif

or

if @fath.class!="none"
  ! work with father record in fath
endif
"To single objects" indicated as "sets" can be set:
wind.set "bounds",objVar
where objVar must be the object name for the expected type of object (it must be object name not an object specifier (currently, window bounds is the only "To single object" that can be set).

Getting Object Properties and "@" Expressions

Object properties are strings or numbers related to the object. Each property can be read with an "@" expression, having generic form:

#prop = @(object).(property)

where (object) is an object specifier (although its (root) can use array variables, when used in an "@" expression, the index for the array cannot use an expression, i.e., can use #ref[3] but not #ref[#i]). The object specifier finds an object and the result of the "@" expression will be the requested (property) of the found object. A valid "@" expression can be used within any expression as the string or number given by the final (property). Some examples are:

#name = @fam.husband.name                               ! name of husband in family record in object fam
#name = @gdoc.individuals.@I329@.children.2.firstName   ! first name of 2nd child of individual

where fam is a object of a family record and gdoc is object for a document.

If any element of the Object specifier returns a None object the result of the "@" expression will be an empty string. For example:

#mother = @indi.mother.name

where indi is an individual record object. If that individual does not have a known mother, @indi.mother will be a None object and the expression will return zero-length string instead of causing an error (note: prior to 3.5/1.0, a None object in a "@" expression would cause en error). A error only occurs in the following conditions:

  1. If a valid GC List or List is followed by number, ID, or name that does not find an object or string in the list.
  2. If a valid Dictionary is followed by a key that is not in the dictionary (you can trap this error using valueForKey command).
  3. If any other valid object is followed by an (atom) or (property) that does not correspond to a defined attribute or property of that object (usually a typo in writing the script).

List and Dictionary Examples

Here are some examples accessing a GC List or List. The expression can find an item in a list. If that item is an object, the expression can continue to a property or attribute of that object:

CreateList numbers,"One","Two","Three,"Four"
#num = @numbers.2                   ! becomes "Three"
#bd = @indis.100.birthdate          ! birth date of 100th individual

Here are some examples for a Dictionary. The expression can find an value by key. If that item is an object, the expression can continue to a property or attribute of that object:

CreateDictionary dict
dict.setStringForKey "key value","string"
dict.setObjectForKey indi,"person"
#test = @dict.string                ! becomes "key value"
#name = @dict.person.name           ! name of individual in object indi

Notes

The option to link objects by this style only available since 3.3/1.0. Internal Scripts for older versions could only use "@" expressions with a single object in one (atom) or a list object followed by second (atom) to select an item from that list. For example:

#name = @indi.name             ! single object allowed
CreateList numbers,"One","Two","Three,"Four"
#num = @numbers.2              ! select item from list in first atom is allowed

All other styles are invalid prior to 3.3/1.0. Version 3.5/1.0 also enhanced some options allowed in object specifiers.

Setting Object Properties

Properties can also be set using an "@" expression with the following syntax

@(object).(property) = (expression)

where (object) is a valid object specifier and (property) is the object's property to be set to string or number from the expression on right side of the equation. The results depend on (object) type:

Notes

Prior to 3.5/1.0, properties that are not designated as read only (or "r/o") could only be set using the set command:

indi.set "birthDate","4 July 1776"       ! same as @indi.birthDate = "4 July 1776"

where property name is first and the new value is second. This set command still works, but the '@' expression approach is easier and more intuitive.

Genealogy Application

This object is the main GEDitCOM II or GEDitCOM application. It is automatically assigned to object name gcapp when an internal scripts starts. Many places in this documentation, refer only to GEDitCOM II, but unless specifically stated all features work in both GEDitCOM II or GEDitCOM.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Genealogy Document

An opened GEDitCOM II document (files with extension gpkg) containing genealogy data.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

GEDCOM Object

This abstract object is not ever used in the script. It defines relations, properties, and commands that are shared by gedcomRecords and structures.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

GEDCOM Structure

A GEDCOM structure that consists of a parent line (with level, tag, and contents) and any subordinate structures under that line at higher level number.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

GEDCOM Record

The base class for all GEDCOM records that defines all relations, properties and commands shared by all other types of GEDCOM records.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Individual Record

A GEDCOM Record documenting a single individual with record type INDI and class type INDIRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Family Record

A GEDCOM Record documenting a single family group (one or two spouses and children) with record type FAM and class type FAMRecord.

Inheritance

To-many object lists

To single objects

Properties

Note than alternateName and name are inherited from gedcomRecord and combines husband's and wife's names in two style, but they are changed to be read only properties.

Supported Object Commands

(return to Object Index)

Place Record

A GEDCOM Record documenting single place. It is a custom record defined in GEDitCOM II with record type _PLC and class type PlaceRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Source Record

A GEDCOM Record documenting a source used in genealogy researching (good genealogy files best documented with all their sources). The record type is SOUR and class type is SOURRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Note Record

A GEDCOM Record for adding notes abot a record or almost any structure within a record. Notes are a good way to add information that does not fit in other places. The record type is NOTE and class type is NOTERecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Repository Record

A GEDCOM Record documenting places where sources are stored (such as a library). The record type is REPO and class type is REPORecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Multimedia Record

A GEDCOM Record with a link to and inforation about a multimedia object or a web site. The record type is OBJE and class type is OBJERecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Report Record

A custom GEDCOM Record in GEDitCOM II to display genealogy reports. The record type is _RPT and class type is ReportRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Research Log Record

A custom GEDCOM Record in GEDitCOM II to enter notes for planned genealogy research tasks. The record type is _LOG and class type is LOGRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Book Style Record

A custom GEDCOM Record in GEDitCOM II to store settings for create books using the the "Create Generations Book" extension. The record type is _BOK and class type is BookRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Header Record

A GEDCOM Record with information about the data in the genealogy file. The record type is HEAD and class type is HEADRecord. Only one header record can be in a file.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Submitter Record

A GEDCOM Record with information about people researching the genealogy data in the file. The record type is SUBM and class type is SUBMRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Submission Record

A GEDCOM Record with information about submitted this GEDCOM data (rarely used and will be removed in future version of the GEDCOM standard). The record type is SUBN and class type is SUBNRecord. Only one submission record can be in a file.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Custom Record

This class is used for any GEDCOM Record in a file that does not correspond to standard GEDCOM records or to any custom records defined by GEDitCOM II. The record type is whatever code you use when creating the record (the GEDCOM standard stipulates that custom record types should being with an underscore character) and class type is OtherRecord.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Album of Records

This class corresponds a user- or script-defined album of records that appears in the main index window for any document.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

GC List

A "GC List" is a fixed list, which means internal scripts have limited options for working with the "GC Lists". In most cases such lists are the actual lists being used internally by GEDitCOM II (e.g., a list of individuals in a document). They are provided as "GC lists" for speed (no need to make copies of long lists) and to keep information in the script in synch with information in GEDitCOM II. (e.g. if the user or the script adds, deletes, or rearranges individuals in a "GC List" from a document, such changes will be made to the "GC List" object in the script as well).

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

List

This class lets a script create a list that can contain objects or strings (see CreateList command). Various commands are available to work with the list members. Also, all "to-many" object attributes of other classes return either a GC List (when possible) or this type of list if the returned list does not correspond to an internal list within GEDitCOM II.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

Dictionary

This class lets a script create a dictionary that contains key-value pairs (see CreateDictionary command). Various commands are available to work with the keys and values.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

ScriptOutput

Scripts that are creating reports typically create one "ScriptOutput" object (see CreateScriptOutput command) to help build the report and then finally display it in a report record window. See the help section on Writing Customizable Reports for more details on using this object for creating reports.

Inheritance

To-many object lists

To single objects

Properties

This class has many properties to control the created report. Although you can read and set all properties for any report style, the ones that matter depend on report style. For html, the only relevant properties ares:

Plain text reports can use the above properties and the following additional properties:

Monospace, can use all above properties and the following additional properties:

Supported Object Commands

(return to Object Index)

Window

This object is for all windows opened in the Genealogy application.

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)

None

This object is returned by any "To-One" object attribute that does not have that connection. If objName in a "None" type object, the conditional ifDef objName is false and the conditional ifNDef objName is true. Alternatively, you can check for "None" type object by seeing if @objName.class is equal to "none".

Inheritance

To-many object lists

To single objects

Properties

Supported Object Commands

(return to Object Index)