Created
September 11, 2013 08:26
-
-
Save brandonpittman/6520775 to your computer and use it in GitHub Desktop.
Create tasks in OmniFocus for each selected task.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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