Skip to content

Instantly share code, notes, and snippets.

@brandonpittman
Created September 11, 2013 08:26
Show Gist options
  • Save brandonpittman/6520775 to your computer and use it in GitHub Desktop.
Save brandonpittman/6520775 to your computer and use it in GitHub Desktop.
Create tasks in OmniFocus for each selected task.
global theFilePath, fileName, notifyMSG
on run
tell application "Finder"
if selection is not {} then
set sel to get selection
if (count sel) is 1 then
set notifyMSG to "1 file was "
else
set notifyMSG to (count sel) & " files were "
end if
repeat with f in sel
set fileName to name of f
set theFilePath to f as alias
my makeTasks()
end repeat
my notify()
else
display alert "No files selected."
end if
end tell
end run
on makeTasks()
tell application "OmniFocus"
set task_title to "Handle: " & fileName
tell document 1
set newTask to make new inbox task with properties {name:task_title}
tell the note of newTask
make new file attachment with properties {file name:theFilePath, embedded:true}
end tell
end tell
end tell
end makeTasks
on notify()
try
set appName to "OmniFocus"
set appID to id of application appName
do shell script "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title " & appName & " -sender " & appID & " -message '" & notifyMSG & "sent to OmniFocus.'"
end try
end notify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment