Skip to content

Instantly share code, notes, and snippets.

@nadavspi
Created May 17, 2015 01:24
Show Gist options
  • Save nadavspi/d7350e6cc24c5f12c15a to your computer and use it in GitHub Desktop.
Save nadavspi/d7350e6cc24c5f12c15a to your computer and use it in GitHub Desktop.
tell application "OmniFocus"
tell front document
tell document window 1
set theSelectedItems to selected trees of content
if ((count of theSelectedItems) < 1) then
display alert "You must first select a single task." message "Select a single task before running this script." as warning
return
end if
if ((count of theSelectedItems) > 1) then
display alert "This script handles only one task at a single blow!" message "Select a single task before running this script." as warning
return
end if
end tell
end tell
end tell
tell application "OmniFocus"
set theDoc to document window 1 of document 1
set theSelectedTask to the value of the first item of the selected tree of the content of theDoc
set theNewTask to the name of theSelectedTask
set the clipboard to theNewTask
end tell
tell application "Alfred 2" to run trigger "toggl start timer" in workflow "com.jason0x43.alfred-toggl" with argument "timers " & (the clipboard as text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment