Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Applescript to create a new task to log ad hoc request to document task for any follow up during weekly review.
-- Copyright (c) 2015 Jason Verly
-- Original script by Dan Byler (bylr.net)
-- Permission is hereby granted, free of charge,
-- to any person obtaining a copy of this software
-- and associated documentation files (the "Software"),
-- to deal in the Software without restriction,
-- including without limitation the rights to use, copy,
-- modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons
-- to whom the Software is furnished to do so,
-- subject to the following conditions:
-- *******
-- The above copyright notice and this permission notice
-- shall be included in ALL copies
-- or substantial portions of the Software.
-- *******
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-- OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- Name: OmniFocus_Ad_Hoc.scpt
-- Revised: 2015-09-05
-- set myFolderName to the name of the folder containing your the destination project
-- set myProjectName to the name of the destination project
-- set myContextName to the name of the destination context
property myFolderName : "Work"
--property myProjectName : "Ad Hoc"
property myProjectName : "Ad Hoc Work"
property myContextName : "Other Work"
on log_item(myTask)
tell application "OmniFocus"
tell default document
-- project
set myFolder to (get first folder whose name is myFolderName)
repeat with thisProject in (flattened projects in myFolder)
if name of thisProject is equal to myProjectName then
set myProject to thisProject
exit repeat
end if
end repeat
-- context
set myContext to (get first context whose name is myContextName)
tell myProject
make task with properties {name:myTask, context:myContext, defer date:(current date)}
end tell
display notification "\"" & myTask & "\"" & " logged to " & name of myProject
end tell
end tell
end log_item
on run
tell application "OmniFocus"
activate
set mystring to text returned of (display dialog "Entry in " & myProjectName & ":" default answer "Enter requested ad hoc task")
my log_item(mystring)
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.