Created
January 1, 2019 17:16
-
-
Save doug4j/5fc27ddb926b19a71f939f0c855988d3 to your computer and use it in GitHub Desktop.
Revisions
-
doug4j created this gist
Jan 1, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ var projName = "My First Auto-created Project"; var app = Application("Omnifocus") app.includeStandardAdditions = true var doc = app.defaultDocument var matchingProjects = doc.flattenedProjects.whose({name: projName}) var theProject = null if (matchingProjects.length == 0) { theProject = app.Project({ name: projName, status: 'active' }) doc.projects.push(theProject) app.displayDialog("Created new project") } else { theProject = matchingProjects[0] app.displayDialog("Reused existing project") } //theProject is now set (whether created new or reading from match)