Hello.
I hope this works, you’ll see where you can add your words. Please do check before and after, that you had a comment, that you changed, (that the item in OmniFocus has your words. And that the original item, has the original Spotlight comment.
property pEmbedFile : true (* if true, file will be embedded
if false, file will be linked *)
property pUseQuickEntry : false (* if true, Quick Entry window used and left open
if false, actions added directly to Inbox *)
property pDefaultProject : "Incoming"
property pDefaultContext : "MacFolderTest"
on adding folder items to this_folder after receiving added_items
try
repeat with i from 1 to number of items in added_items
set this_item to item i of added_items
tell application "Finder"
set file_name to (name of this_item)
set file_cmt to (comment of this_item)
set comment of this_item to "whatever you like"
end tell
tell application "OmniFocus"
if (pUseQuickEntry) then
set theContext to (first flattened context where its name = pDefaultContext as rich text)
set theProject to (first flattened project where its name = pDefaultProject)
tell quick entry
open
tell theProject
set NewTask to make new task with properties {name:file_name, context:theContext}
tell the note of NewTask to make new file attachment with properties {file name:this_item, embedded:pEmbedFile}
end tell
activate
end tell
else
tell front document
set theContext to (first flattened context where its name = pDefaultContext as rich text)
set theProject to (first flattened project where its name = pDefaultProject)
tell theProject
set NewTask to make new task with properties {name:file_name, context:theContext}
tell the note of NewTask to make new file attachment with properties {file name:this_item, embedded:pEmbedFile}
end tell
end tell
end if
end tell
if pEmbedFile then tell application "Finder" to set comment of this_item to file_cmt
end repeat
on error e number n
my logit("Error: " & e & " " & n, "toOmnifocus")
end try
end adding folder items to
to logit(log_string, log_file)
do shell script ¬
"echo `date '+%Y-%m-%d %T: '`\"" & log_string & ¬
"\" >> $HOME/Library/Logs/" & log_file & ".log"
end logit