Last active
August 29, 2015 14:23
-
-
Save joelcarranza/cc5d88553ed9cdcafa26 to your computer and use it in GitHub Desktop.
This file contains 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
/*------------------------------------------------------------------- | |
Create Omnifocus Task For Active Tab | |
Quickly create a task for a given tab. The task title is the name of | |
the tab and the note contains a URL to that tab | |
Source: | |
https://gist.github.com/joelcarranza/cc5d88553ed9cdcafa26 | |
-------------------------------------------------------------------*/ | |
app = Application('Chrome'); | |
app.includeStandardAdditions = true; | |
tab = app.windows[0].activeTab(); | |
tabTitle = tab.name(); | |
tabURL = tab.url(); | |
// TODO: verify OmniFocus is running and otherwise launch | |
var OF = Application('com.omnigroup.OmniFocus2'); | |
OF.includeStandardAdditions = true; | |
// TODO: select context based on general context ? | |
var gksContext = OF.defaultDocument.flattenedContexts.whose({name:'GKS'})[0] | |
var taskName = tabTitle; | |
taskName = taskName.replace(/\s*- JIRA$/,''); | |
// scan for appropriate projects to place task | |
task = OF.Task({name:taskName,note:tabURL,context:gksContext}); | |
OF.defaultDocument.inboxTasks.push(task); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment