Please see page 35 (as of 20131027) of the Aeon Timeline manual for information about Aeon’s Import feature.
The following script is based on an earlier work provided by DEVONtechnologies, (Scripts > Export > Export Metadata as CSV), though it is extensively re-written.
A comma-separated-values file (.csv) is created that contains exported from metadata properties of the selected records in a DEVONthink database. This is the mapping between DEVONthink record properties (left side) and Aeon’s Event properties (right side):
- Creation Date --> Start Date (always exported)
- Modification Date --> End Date (optional; but exported by default)
- Name (of record) --> Event Title (always exported)
- Tags (of record) --> Tags (optional; but exported by default)
- Comments (Spotlight Comments) --> Notes (optional; but exported by default)
- Reference URL (the x-devonthink URL of a record) --> Links (optional; but exported by default)
- URL (the link to an external source or another record) --> Links (optional; but exported by default)
Note that as of 20131027 Aeon does not support the Reference URL (x-devonthink link) but this is included in case a future release of Aeon will support this. At this time, Aeon merely reports this as an error with the icon that indicates the URL needs to be edited.
Within the script there are several properties that can be switched from True to False to turn on/turn off the optional property exports.
Aeon does not sense that a new import contains duplicates. Unless you want duplicates, be careful to select carefully the records that you want to export from DEVONthink. The script does not support Aeon event properties “Arc”, “Label” or “Participants” as there is no direct corollary of those properties in a DEVONthink record. (DEVONthink “Label” and Aeon “Label” are different things, despite the term.)
I will be unable to support this script or implement change requests.
(*
Export data for selected DEVONthink records as a CSV file
This CSV can be imported into an Aeon Timeline timeline.
See page 35 (as of 20131027) of the Aeon Timeline manual for an explanation
of Aeon's import feature.
This script is not guaranteed to work and the author will not update it if it breaks.
The script is based on the following work published with DEVONthink Pro Office (as of
20131027)
-- Export Metadata (Name, URL, Comment, Tags & Annotations) as double-quoted CSV.
-- Created by Christian Grunenberg on Fri Dec 03 2010.
-- Copyright (c) 2010. All rights reserved.
*)
(*
Change one or more of the following property switches to "false" if you do not
want to export the referenced element. The script will always export the record's
Creation Date as the Aeon Start Date of an event. The script will always export
the record's Name as the Aeon Event Title of an event. Otherwise, the remaining
properties are optional.
*)
property s_useModification : true -- if true, will use "Modification Date" as Aeon End Date
property s_useTags : true -- if true, will use the record's tags as Aeon Tags
property s_useComments : true -- if true, will use the records Comments (Spotlight Comments) as Aeon Notes
property s_useRefURL : true -- if true, will use the record's x-devonthink URL as an Aeon Link
property s_useURL : true -- if true, will use the record's URL (external URL) as an Aeon Link
tell application id "DNtp"
try
set theSelection to the selection
if theSelection is {} then error "Please select some documents."
set theFile to choose file name default name "Export.csv"
show progress indicator "Exporting..."
set h_start to "\"Start Date\"," -- always exported
set h_mod to ""
if s_useModification then set h_mod to "\"End Date\","
set h_title to "\"Event Title\"," -- always exported
set h_tags to ""
if s_useTags then set h_tags to "\"Tags\","
set h_notes to ""
if s_useComments then set h_notes to "\"Notes\","
set h_links to ""
if s_useRefURL then set h_links to "\"Links\""
if s_useURL then set h_links to "\"Links\""
set theCSV to h_start & h_mod & h_title & h_tags & h_notes & h_links & return
-- set theCSV to "\"Start Date\",\"End Date\",\"Event Title\",\"Tags\",\"Notes\",\"Links\"" & return
set theCSV to theCSV & my createCSV(theSelection)
set thePath to POSIX path of theFile
if thePath does not end with ".csv" then set thePath to thePath & ".csv"
do shell script "echo " & quoted form of theCSV & ">" & quoted form of thePath
hide progress indicator
on error error_message number error_number
hide progress indicator
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell
on createCSV(theseRecords)
local start_date, end_date, event_title, these_tags, these_notes, these_links
tell application id "com.devon-technologies.thinkpro2"
set this_csv to ""
repeat with this_record in theseRecords
if type of this_record is not group then
set start_date to creation date of this_record as string
set this_csv to this_csv & my prepareCSV(start_date)
if s_useModification then
set end_date to modification date of this_record as string
set this_csv to this_csv & my prepareCSV(end_date)
end if
set event_title to name of this_record as string
set this_csv to this_csv & my prepareCSV(event_title)
if s_useTags then
set {od, text item delimiters of AppleScript} to {text item delimiters of AppleScript, return}
set these_tags to (tags of this_record) as string
set text item delimiters of AppleScript to od
set this_csv to this_csv & my prepareCSV(these_tags)
end if
if s_useComments then
set these_notes to comment of this_record as string
set this_csv to this_csv & my prepareCSV(these_notes)
end if
if (s_useRefURL or s_useURL) then
set these_links to ""
if s_useRefURL then
set these_links to these_links & (the reference URL of this_record as string) & ";"
end if
if s_useURL then
set these_links to these_links & (the URL of this_record as string) & ";"
end if
set this_csv to this_csv & my prepareCSV(these_links)
end if
set this_csv to this_csv & return
end if
end repeat
end tell
return this_csv
end createCSV
on prepareCSV(theString)
if theString contains "\"" then
local od
set {od, text item delimiters of AppleScript} to {text item delimiters of AppleScript, "\""}
set theString to text items of theString
set text item delimiters of AppleScript to "\"\""
set theString to "" & theString
set text item delimiters of AppleScript to od
end if
return "\"" & theString & "\"" & ","
end prepareCSV