Last active
December 21, 2015 02:59
-
-
Save brandonpittman/6238756 to your computer and use it in GitHub Desktop.
Smartly open perspectives in OmniFocus.
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
--The most current version of SmartPerspective is now in a GitHub repo. (https://github.com/brandonpittman/OmniFocus/blob/master/SmartPerspective.applescript) | |
on run | |
open_perspective() | |
end run | |
on open_perspective() | |
tell application "OmniFocus" | |
tell default document | |
if (count inbox tasks) > 0 then --this is for your Inbox | |
my conditions("Inbox") | |
return | |
end if | |
if number of available tasks of flattened project "Daily" > 0 then --this could be titled "Routine" possibly | |
my conditions("Daily") | |
return | |
end if | |
if (count (every available task of every flattened context whose flagged is true)) > 0 then | |
my conditions("Flagged") | |
return | |
end if | |
if (count (every available task of every flattened context)) > 0 then | |
my conditions("Next Actions") | |
return | |
end if | |
if visible of front document window is true then | |
my conditions("Someday") | |
end if | |
end tell | |
end tell | |
end open_perspective | |
on conditions(perName) | |
tell application "OmniFocus" | |
tell default document | |
if visible of front document window is true then | |
set perspective name of document window 1 to perName | |
else | |
make new document window with properties {perspective name:perName} at end of document windows | |
activate | |
end if | |
end tell | |
end tell | |
end conditions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment