In OF for macOS, there is the possibility to add the link to a file on the hard drive to a note. This is very convenient to quickly access a file and is also described in a recent OmniShow).
The method is described here in the OF help. A very similar methodology is implemented in OmniOutliner.
** → is it possible to generate such a link in applescript (or in some other way) automatically?**
I am asking because I try to setup a Hazel rule that creates a new OF task when a new file occurs in a folder, and this would provide easy access to this file?
In the distant past, I have been doing this with
tell application "System Events" to set myFileUrl to URL of theFile
However, the resulting link that starts with file:///...
seems to not work from any mac app anymore… Is this a generally true or is something wrong with my setup?
** UPDATE 2020-Dec-05 **
ok, I have this script that watches the folder and creates a task in the proper project with the proper tag
set theDate to current date
set theTask to “Rechnung ABC”set theNote to “Scanned and processed on” & (theDate as string) & return
tell application “OmniFocus”
tell front document
set theTag to first flattened tag where its name = “do online”
set theProject to first flattened project where its name = “Finanzen”
set theDueDate to theDate + (24 * hours)
tell theProject to make new task with properties {name:theTask, note:theNote, primary tag:theTag, due date:theDueDate}
end tell
end tell
on the other hand, I have this code, that likely mimics the “generate link” feature that I mention at the beginning:
tell application “OmniFocus”
tell quick entry
open
set NewTask to make new inbox task with properties {name:file_name}
tell the note of NewTask
make new file attachment with properties {file name:this_item, embedded:true}
end tell
activate
end tell
end tell
So, in the first example, how do I tell the note (note:theNote
) that I create within the new task of theProject
to include the file attachment? – I would prefer the note created in the proper project and not in the quick entry.
Thanks for your help.
Claus