Skip to content

Commit

Permalink
Adding: Focus in New Window
Browse files Browse the repository at this point in the history
  • Loading branch information
dbyler committed May 9, 2015
1 parent 791469f commit d52a8be
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 2 deletions.
71 changes: 71 additions & 0 deletions Focus in New Window.applescript
@@ -0,0 +1,71 @@
(*
# DESCRIPTION #
Inspired by OmniFocus 1 behavior, this script opens the selected task's (or tasks')
project(s) in a new window so you can jump from a context view into the project view
without losing place.
# LICENSE #
Copyright © 2015 Dan Byler (contact: dbyler@gmail.com)
Licensed under MIT License (http://www.opensource.org/licenses/mit-license.php)
(TL;DR: no warranty, do whatever you want with it.)
# CHANGE HISTORY #
1.0 (2015-04-28)
- Initial release
# INSTALLATION #
1. Copy script to OmniFocus script folder (OmniFocus -> Help -> Open Scripts Folder)
2. (Optional) Update to use the icon in this repo
3. Add script to the OmniFocus toolbar using View -> Customize Toolbar...
*)


on main()
tell application "OmniFocus"
set myFocus to {}
-- get selection
tell content of front document window of front document
set validSelectedItemsList to value of (selected trees where class of its value is not item and class of its value is not folder)
set totalItems to count of validSelectedItemsList
if totalItems is 0 then
my notifyWithoutGrowl("No valid task(s) selected")
return
end if
repeat with validSelectedItem in validSelectedItemsList
validSelectedItem
if (containing project of validSelectedItem) is not missing value then
set end of myFocus to (containing project of validSelectedItem)
else if (assigned container of validSelectedItem) is not missing value then
set end of myFocus to (assigned container of validSelectedItem)
end if
end repeat
end tell

-- no valid projects to focus on
if length of myFocus is 0 then
my notifyWithoutGrowl("No projects to focus")
return
end if

-- make new window
tell default document
make new document window with properties {perspective name:"Projects"}
end tell

-- set focus
tell front document window of front document
set focus to myFocus
end tell
end tell
end main

on notifyWithoutGrowl(alertText)
tell application "OmniFocus" to display dialog alertText with icon 1 buttons {"OK"} default button "OK"
end notifyWithoutGrowl

main()
Binary file added FocusIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 40 additions & 2 deletions README.markdown
@@ -1,3 +1,41 @@
This is a collection of AppleScripts I use to enhance my OmniFocus workflow. They are also available for download at http://bylr.net/files/.
This is a collection of AppleScripts I use to enhance my OmniFocus workflow.

All are released under the MIT license. Feel free to get in touch with me (github@dbyler.eml.cc).
All are released under the MIT license. Feel free to get in touch at github@dbyler.eml.cc

# Scripts

## Clear Dates

- Clears Defer and Due dates from selected items

## Focus in New Window

- Opens the projects of the currently selected task(s) in a new Window

## Shift (neé Defer)

- Time-shifts both Defer and Due dates of selected items
- Mental model: "Adjust all relevant time parameters of these items"

## Snooze

- Time-shifts the Defer dates of selected items, relative to today
- Mental model: snooze button on an alarm clock. "I can't take action on this until _n_ days from now."

## This Weekend

- Snoozes the selected item(s) until the upcoming weekend

## Today

- Sets Defer (or Due) date of item to today
- Note: I no longer use or actively maintain this script

## Tomorrow

- Sets Defer (or Due) date of item to tomorrow
- Note: I no longer use or actively maintain this script

## Total Time

- Aggregates time estimates of selected items

0 comments on commit d52a8be

Please sign in to comment.