Last active
June 12, 2019 10:50
-
-
Save judismith/5760182 to your computer and use it in GitHub Desktop.
Script for use with Hazel to create a new project in OmniFocus when a new folder is created in the top level project folder. Apparently Hazel doesn't like it when you tinker with the variable "theFile" within the script. Also it seems that Hazel doesn't allow functions in the internal applescripts.
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
tell application "Finder" | |
-- set theFile to "Macintosh HD:Users:[username]:Google Drive:Matters:Test Folder:" -- For testing | |
set myFile to do shell script "basename " & (the quoted form of (the POSIX path of theFile)) | |
-- check to see if it is worth starting OF | |
if myFile does not start with "_" and (theFile as string) ends with ":" then | |
set theDueDate to (current date) + 7 * days | |
tell application "OmniFocus" | |
-- activate | |
tell default document | |
set oContext to first flattened context where name = "Plan/Prepare" | |
tell (first flattened folder where name = "New Matters") | |
tell (make new project with properties {name:myFile}) to ¬ | |
make new task with properties {name:"Set up " & myFile & " project", context:oContext, due date:theDueDate, start date:(current date), flagged:true} | |
end tell | |
end tell | |
end tell | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment