Here’s a script for Hook to New
that adds a “Hook” tag to OmniFocus if OmniFocus does not yet have it, and the script adds the tag to the new task. You could rename the tag to something else.
If you want to try the script:
- open Hook’s preferences;
- click on the Scripts tab;
- select the correct OmniFocus 3 entry in the tab on left based on your copy of OmniFocus (i.e., app store vs. OmniGroup store) ;
- click on
Link to New
tab - paste the script below into it;
- click the save button (bottom right).
If you want to revert to the built in script, just select the OmniFocus button on bottom left and click the “-” button. See also Scripts Tab – Hook.
caveat emptor. I’m not one of our script authors and they have not vetted this. Works in my limited tests on OmniFocus3 from OmniGroup store, which I use. Not extensively tested. Only designed for Link to New
, not for adding and removing links. We should provide one of them too. Also, of course, this is just another small step towards tagging in Hook.
tell application "OmniFocus"
activate
tell first document
-- remove extraneous text from URL
set AppleScript's text item delimiters to {"$$$"}
set srcURL to text item 1 of "$link"
-- Create a new task and note
set myTask to make new inbox task with properties {name:"$title", note:"$title"}
try
set taskTag to (first flattened tag where its name is "Hook")
on error
set taskTag to make new tag with properties {name:"Hook"}
end try
add taskTag to tags of myTask
-- hyperlink-ify the note
set value of attribute named "link" of style of paragraph 1 of note of myTask to srcURL
set taskID to "omnifocus:///task/" & (id of myTask)
-- open task
GetURL taskID
-- return URL of task for Hook to link with source item
get taskID
end tell
end tell