For some reason I need to convert all the French Republic calendar dates in
my Gedcom file to Gregorian ones.
Is there an easy way to do so?
I don't mind trying to write a script for that, but as I am not a
specialist, could you give me some clues about how you would do it, please?
Thanks a lot.
A side question, by the way: would it be possible to add something like
[GEDitCOM II] in the e-mail titles? It would be easier to follow mails
coming from this discussion list. Thanks again.
Best,
--
Stéphane LELAURE
> A side question, by the way: would it be possible to add something like
> [GEDitCOM II] in the e-mail titles? It would be easier to follow mails
> coming from this discussion list. Thanks again.
I would also find this helpful.
(* Convert all dates in the file to Gregoria dates
*)
global changes
set changes to 0
tell application "GEDitCOM II"
tell front document
begin undo
-- do individuals
my convert(every individual whose gedcom contains "DATE")
-- do families
my convert(every family whose gedcom contains "DATE")
end undo action "Convert Dates"
end tell
end tell
return "Dates Converted: " & changes
(* Check all DATE tags in record with id recID. If any contain French
Republic Month, convert to Gregorian.
*)
on convert(recRefs)
local numRecs
set numRecs to number of items in recRefs
repeat with i from 1 to numRecs
tell application "GEDitCOM II"
tell item i of recRefs
set recDates to find structures tag "DATE" output "references"
set numd to number of items in recDates
repeat with j from 1 to numd
set oneDate to item j of recDates
set currentDate to contents of oneDate
tell application "Date Calculator"
set newDate to (convert date currentDate to "Gregorian")
end tell
if newDate is not currentDate and first word of newDate is not "Error:" then
set contents of oneDate to newDate
set changes to changes + 1
end if
end repeat
end tell
end tell
end repeat
end convert
Description:
The script goes through all individuals and family records that have at least one DATE line. If finds all those lines (with the find structures command). For each date found, it sends the current date to the Date Calculator to convert to "Gregorian". Many dates will already be Gregorian and thus the returned date will be the same. This script only makes a change when the new date is different (and when first word is not "Error:" which means the Date Calculator could not covert it). When a good new date is found, it is changed and the number of changes is counted. When the script ends, it reports the number that where changed.
A side note: I found out recently that the convert date ... to ... command in Date Calculator has keywords that may conflict with standard AppleScript key words (date and to). The next version of GEDitCOM II will include a new Date Calculator that updates it sAppleScript commands to avoid such conflicts. I think any saved, compiled scripts will convert themselves, but the text of the commands will be different.
------------
John Nairn
http://www.geditcom.com
Genealogy Software for the Mac
I won't use this script very much, so it's OK with me.
I didn't know the Date Calculator was scriptable as well. It may be useful
to know.
Thanks again,
Best,
--
Stéphane LELAURE
le 1/12/10 7:09, John Nairn à jo...@geditcom.com a écrit :