@alex, I crafted an AppleScript for you that might help. If you export your notes into a
comma-delimited tab-delimited file with a structure such as this:
Quote:Name Tags Text
"First document" "red;blue;yellow" "This is the first document text"
"Second document" "pink passion;green" "This is the second document text"
Put your tags into the second element of the export as a semicolon-delimited string (a quoted string is recommended).
Then, import that file into DEVONthink, it will become what DEVONthink calls a sheet - a table of rows and columns
Select that sheet in DEVONthink and run this script, you will get individual RTF records for each of the rows of the sheet. The name, tags, and text will be assigned per their respective columns of the sheet.
Code:(*
This script will create a new RTF document from each row of a "sheet". The sheet should have three columns.
Column 1: the name of the new document
Column 2: the tags for the new document, delimited by semicolons
Column 3: the text for the new document
The column header names are not relevant, but it is useful to name them "Name", "Tags", and "Text", respectively.
Select the sheet and run the script. The script will prompt for the target location of all the documents to be
created.
*)
tell application id "com.devon-technologies.thinkpro2"
try
if not (exists think window 1) then error "No Window is Open"
set this_window to think window 1
tell this_window
copy number of rows to rowCount
copy number of columns to colCount
set targetGroup to display group selector "Destination group?"
set currRow to 1
repeat while currRow ≤ rowCount
set theName to get cell at row currRow column 1
set tagList to get cell at row currRow column 2
set theText to get cell at row currRow column 3
create record with {name:theName, tags:(my getTags(tagList)), type:rtf, rich text:theText} in targetGroup
set currRow to currRow + 1
end repeat
end tell
end try
end tell
on getTags(tagList)
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ";"}
set tagList to text items of tagList
end getTags
I can modify this script to read a fourth element (column) of the table which corresponds to the path for each note, and the script will put the documents into a hierarchy of folders in DEVONthink. However, this is a bit more complex and it will take me a while to code and test it.
As DEVONthink parses tags and automatically de-duplicates them, you shouldn't need to do any preprocessing of your tag set attribute to eliminate duplicates.
I trust you can do the export template in Tinderbox pretty easily.
Or see Mark Anderson's post, following this one.Edit: I've later found that DEVONthink does not reliably recognize .csv (comma-separated values) files as sheets, but will reliably convert .tsv (tab-separated values) files to sheets. I've asked Mark Anderson to amend his export recipe accordingly, which is, I believe, a simple adjustment.