I am attempting to create a daily To Do List by generating an RTF file.
The file lists the names of records that are marked as “(TASK)” in the comments field and collected in a Smart Group. ```
tell application “DEVONthink Pro”
tell application “DEVONthink Pro”
set groupName to “ToDoToday”
set theRecord to create location “CONTEXTS/(TASK)”
set theString to “(TASK)”
search theString comparison no case within comments operator any word replicate to theRecord with removing replicants
end tell
try
set these_items to the children of theRecord
set theAssemble to “”
set theCnt to 0
repeat with this_item in these_items
set this_Name to the name of this_item
set theAssemble to theAssemble & this_Name & return
set theCnt to theCnt + 1
end repeat
set shortDate to do shell script “date +%d/%m/%y”
if (theCnt > 0) then
create record with {name:" To Do: " & (shortDate) & " (" & (theCnt as string) & “)”, type:rtf, rich text:theAssemble}
end if
on error error_message number error_number
if the error_number is not -128 then
display dialog error_message buttons {"OK"} default button 1
end if
end try
end tell
(please excuse the messiness- I can't seem to get rid of that double "tell" at the beginning)
The Problem:
For some reason the resulting file is not an RTF and if I change "rich text:theAssemble" to "text:theAssemble" the content of the resulting file comes up empty. Otherwise it works fine.
Any Ideas?