I have about 400 plain text notes, very simple just title and note text. Is there an easy way to export the lot as a CSV file with just the two columns?
The only possibility would be a script, e.g.
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 theCSV to "\"Name\";\"Note\"" & 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" message error_message as warning
end try
end tell
on createCSV(theseRecords)
local this_record, this_csv, this_name
tell application id "DNtp"
set this_csv to ""
repeat with this_record in theseRecords
set this_name to name of this_record as string
step progress indicator this_name
set this_csv to this_csv & my prepareCSV(this_name) & ";"
set this_csv to this_csv & my prepareCSV(plain text of this_record as string) & return
-- set this_csv to this_csv & my createCSV(children of this_record)
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
Wow, thanks so much for this. I got it to work. Very grateful for your personal help.