Re: Gedcom's and source citations
Here is the program. Copy and paste it into the AppleScript Editor program that comes bundled with MacOS. Save it somewhere on your disk so you can use it again. Be sure to turn off display of the Event Log by clicking on Event Log until the window below the listing disappears. (Otherwise the program runs glacially slow) Click Compile then click Run. It will ask you for the name/location of your Reunion-produced GED file, then ask you to name/locate an output file (which it will create). It beeps every so often to let you know it's still running. Puts up a dialog box when it's finished. Hope it helps someone else!
Don
--
-- Convert Reunion GED file so that sources are reasonably displayed in Ancestry.com
--
try
set theFile to (choose file with prompt "Select the Reunion GED file to convert:")
on error
return
end try
try
open for access theFile
on error
display dialog "File open failed!"
return
end try
try
set newFile to (choose file name with prompt "Where should I save the output GED file?")
on error
return
end try
try
open for access newFile with write permission
on error
display dialog "File open failed!"
return
end try
set fileRemaining to (get eof theFile)
set eof of newFile to 0
set mode to 0
set recordCount to 0
repeat while fileRemaining is greater than 0
set fileRecord to (read theFile until return as string)
set fileRemaining to fileRemaining - (count fileRecord)
set recordCount to recordCount + 1
if recordCount mod 1000 is 0 then
beep
beep
end if
if last character of fileRecord is not (ASCII character 13) then
set fileRecord to fileRecord & (ASCII character 13) as text
end if
if first character of fileRecord is (ASCII character 10) then
-- strip line feeds from Windows files
if (count fileRecord) ≤ 1 then
set fileRecord to (ASCII character 13) as text
else
set fileRecord to characters 2 through (count fileRecord) of fileRecord as text
end if
end if
if first character of fileRecord = "0" then
set mode to 0
set foundFirst to 0
if characters ((count fileRecord) - 4) through ((count fileRecord) - 1) of fileRecord as text = "SOUR" then
set mode to 4
end if
end if
if (mode is 4) and (characters 1 through 1 of fileRecord as text) = "1" then
if foundFirst = 0 then
set foundFirst to 1
set fileRecord to "1 TITL" & (characters 7 through (count fileRecord) of fileRecord as text)
else
set fileRecord to "2 CONT" & (characters 7 through (count fileRecord) of fileRecord as text)
end if
end if
if (count fileRecord) > 1 then
write fileRecord to newFile
end if
end repeat
close access theFile
close access newFile
display dialog "Processing Completed Successfully!"
|