The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   On desktop banner of current action (http://forums.omnigroup.com/showthread.php?t=13507)

fathom 2009-08-25 03:34 PM

On desktop banner of current action
 
Hi all. I have a hopefully easy question for you all. I searched and searched, to no avail. I am not sure even what the right search terms would be.

What I would like is a sort of desktop banner that displays my current action (maybe the selected current action, or a list of next actions). I'm thinking of something like a widget that sits on the desktop, probably either at the top of the screen or the bottom, probably at the lowest level (below any other windows that might be there). And, it should show on all Spaces.

The issue is that I can get easily distracted and have a difficult time focusing and not getting distracted. If I had some action item that was always on display, I could easily jump back on track without having to switch to the OmniFocus window, and I could see it no matter which Space I'm in.

Does something like this exist? Or maybe even a menu bar widget? Is there a way to make OmniFocus do this, or is there a plugin, or...?

Thanks!

malisa 2009-08-25 04:10 PM

Sounds like Growl will do what you want. Search for growl here and see what you think.

curt.clifton 2009-08-25 06:14 PM

The script below will display a Growl note listing all selected actions. You can use the Growl system preference pane to configure the notification to be sticky and on all desktops. (An earlier version of this is kicking around on the forums.)

[CODE]
(*
This script uses Growl to display a sticky note about what you are supposed to be focusing on.

version 0.1, by Curt Clifton

Copyright © 2007-2008, Curtis Clifton

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

version 0.1: Original release
*)


(*
The following properties are used for script notification via Growl.
*)
property growlAppName : "OmniFocus Stickies"
property notification : "Stick it"
property defaultNotifications : {notification}
property allNotifications : defaultNotifications
property iconLoaningApplication : "OmniFocus.app"

tell application "OmniFocus"
tell front document
tell content of document window 1 -- (first document window whose index is 1)
set theSelectedItems to name of every selected tree
if ((count of theSelectedItems) < 1) then
display alert "You must first select an item to work on." as warning
return
end if
end tell
end tell
end tell
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set theItemsText to theSelectedItems as text
set AppleScript's text item delimiters to oldDelim
my notify("What are you doing?", theItemsText, notification)

(*
Uses Growl to display a notification message.
theTitle – a string giving the notification title
theDescription – a string describing the notification event
theNotificationKind – a string giving the notification kind (must be an element of allNotifications)
*)
on notify(theTitle, theDescription, theNotificationKind)
tell application "GrowlHelperApp"
register as application growlAppName all notifications allNotifications default notifications defaultNotifications icon of application iconLoaningApplication
notify with name theNotificationKind title theTitle application name growlAppName description theDescription with sticky
end tell
end notify
[/CODE]

fathom 2009-08-25 07:15 PM

Thank you both. I tried the script. It is nice. Not exactly what I would like, but it'll work until I figure something else out. I would love to have it tie in with some sort of a desktop widget that sits below windows or in a menu bar. The best Growl notification type is called Music Video, but it slides over your windows, and it disappears after a few seconds -- no way to keep it on screen (sticky) and no way to make it below. I could use one of the "bubble" type notifications, but again, that'll sit on top and block my work.

That said, it's better than anything else now, and I'll try it. Thank you. One thing that I am excited about is that this script demonstrates how to get the current actions for possible use in some desktop or menu bar widget, if I can find one.

Thanks!

Toadling 2009-08-25 08:19 PM

What about [URL="http://projects.tynsoe.org/en/geektool/"]GeekTool[/URL]? Doesn't that allow you to display data as part of your desktop background? I've never tried it myself, but I've heard others talk about it. I'm not sure if it can display the output from an AppleScript directly, but maybe you could use the oascript shell command if necessary.

-Dennis

fathom 2009-08-25 09:17 PM

[QUOTE=Toadling;65220]What about [URL="http://projects.tynsoe.org/en/geektool/"]GeekTool[/URL]?[/QUOTE]

Oh wow. That is cool in so many ways! Thanks. I'll attempt cobble together this and Curt's script.

fathom 2009-08-25 10:52 PM

1 Attachment(s)
Aha! It works perfectly, exactly as I had envisioned. Thank you three for your suggestions. All of your advice, put together, equals very happy.

It's actually pretty cool. It updates automatically, displays whatever actions are selected. Change the selection, and automatically, the pane updates. Here's a screenshot:

[ATTACH]1034[/ATTACH]

If you want to do this too, follow these steps:
1. Open ScriptEditor.
2. Paste this code into it.
[CODE](*
This script works with GeekTool to display the currently selected actions in OmniFocus. This script is modified from a script originally designed to display the currently selected actions in Growl.

version 0.2, by James A. Jones
version 0.1, by Curt Clifton

Copyright © 2009, James A. Jones
Copyright © 2007-2008, Curtis Clifton

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

version 0.2: GeekTool modification
version 0.1: Original release
*)
set newline to ASCII character 10

property iconLoaningApplication : "OmniFocus.app"

tell application "OmniFocus"
tell front document
tell content of document window 1 -- (first document window whose index is 1)
set theSelectedItems to name of every selected tree
if ((count of theSelectedItems) < 1) then
display alert "You must first select an item to work on." as warning
return
end if
end tell
end tell
end tell
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set theItemsText to theSelectedItems as text
set AppleScript's text item delimiters to oldDelim
set output to ""
repeat with selectedItem in theSelectedItems
set output to output & selectedItem & newline
end repeat
output[/CODE]
3. Save the code to a file in your ~/Library/Scripts directory as GeekFocus.scpt or something like that.
4. Install [URL="http://projects.tynsoe.org/en/geektool/"]GeekTool[/URL]
5. In the preferences pane for GeekTool, drag the Shell window out to your desktop.
6. In the preferences window for the Shell window, in the Command field, specify "osascript ~/Library/Scripts/GeekFocus.scpt"
7. Change the update frequency to something reasonable that won't cause too much CPU overhead. I set it to 10 seconds. I changed the timeout to 5 seconds.
8. Change the dimensions, font size/color, and anything else to your hearts content.
9. Enjoy.

curt.clifton 2009-08-26 03:39 AM

That's great. Thanks for sharing back. I may have to finally give GeekTool a try.

xmas 2009-08-26 02:23 PM

1 Attachment(s)
[IMG]http://forums.omnigroup.com/attachment.php?attachmentid=1036&stc=1&d=1251325351[/IMG]

This is totally sweet, I stuck it in my System menu bar.


I think the way I'll manage this is putting OmniFocus on it's own "space", and just switch over and update the selected action when I finish something off.

fathom 2009-08-26 02:36 PM

[QUOTE=xmas;65254][IMG]http://forums.omnigroup.com/attachment.php?attachmentid=1036&stc=1&d=1251325351[/IMG]

This is totally sweet, I stuck it in my System menu bar.


I think the way I'll manage this is putting OmniFocus on it's own "space", and just switch over and update the selected action when I finish something off.[/QUOTE]

How the heck did you do that?!!!! That's even better!

xmas 2009-08-26 03:07 PM

[QUOTE=fathom;65257]How the heck did you do that?!!!! That's even better![/QUOTE]

0% opacity background
check "Always on Top"
use Lucida Grande 14 (I think) pt Font to blend in

(annoyed that it's a little fuzzy, but good enough for now)

then just drag the window on top of the titlebar.

The caveat is that I only want to have 1 action showing, more and I might need to make it output in a line. I might also play around with exporting attributed text so I can the the note in there as well in a non-bold font.

curt.clifton 2009-08-26 04:24 PM

I had some fun playing with this tonight and made a few enhancements. My updated version is below. Significant changes:[LIST][*] got rid of the alert dialog that would appear if no items were selected,[*] added bullets in front of the items,[*] added a property to set the maximum length of displayed actions. Any actions longer than this are truncated now. Set it really large to avoid truncation.[/LIST]
Install instructions above still apply, but here's the updated code:
[CODE]
(*
This script works with GeekTool to display the currently selected actions in OmniFocus. This script is modified from a script originally designed to display the currently selected actions in Growl.

version 0.2, by James A. Jones
version 0.1, by Curt Clifton

Copyright © 2009, James A. Jones
Copyright © 2007-2009, Curtis Clifton

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

version 0.2.1: Eliminated alert dialog for no actions selected, misc. enhancements
version 0.2: GeekTool modification
version 0.1: Original release
*)

-- Edit the number in the line below to control maximum number of characters for each displayed action:
property maximumLength : 25

property actionBullet : "* "
property noSelectionMessage : "[no actions selected in OmniFocus]"

tell application "OmniFocus"
tell front document
tell content of document window 1
set theSelectedItems to name of every selected tree
if ((count of theSelectedItems) < 1) then
return noSelectionMessage
end if
end tell
end tell
end tell

set theSelectedItems to my trimItems(theSelectedItems, {})

-- Standard Applescript incantation to turn a list into a delimited string:
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to (return & actionBullet)
set theItemsText to theSelectedItems as text
set AppleScript's text item delimiters to oldDelim
-- Slaps a bullet on the front and returns the string:
return actionBullet & theItemsText

on trimItems(xs, accum)
if xs is {} then return reverse of accum
set truncatedItem to item 1 of xs
if ((length of truncatedItem) > maximumLength) then
set truncatedItem to text from character 1 to character maximumLength of truncatedItem
set truncatedItem to truncatedItem & "..."
end if
set accum to {truncatedItem} & accum
return trimItems(rest of xs, accum)
end trimItems
[/CODE]

fathom 2009-08-26 07:42 PM

[QUOTE=xmas;65264]0% opacity background
check "Always on Top"
use Lucida Grande 14 (I think) pt Font to blend in

(annoyed that it's a little fuzzy, but good enough for now)

then just drag the window on top of the titlebar.

The caveat is that I only want to have 1 action showing, more and I might need to make it output in a line. I might also play around with exporting attributed text so I can the the note in there as well in a non-bold font.[/QUOTE]

Ohhh. That's funny. So, it isn't really on the title bar, it is just a transparent window sitting on top of it. Such a simple solution that I never would have thought of :-) Good job! Thanks!

CVN 2009-09-04 12:56 AM

I want ALL my Due tasks exportet to GeekTool, but I am not a scripter, so I can not get the text out. (I just want the task names and the project)

Do you now the trick?

curt.clifton 2009-09-04 07:16 AM

CVN,

That's a harder problem. To completely automated it you need a script that "walks" the entire tree of projects and actions in OF, calculates which ones are due (based on action due date or parent due dates), and outputs the right text. Additionally the script probably should detect which tasks are available and only show those.

That's an interesting problem, so I might take a crack at it sometime.

In the interim, you can open the Due perspective in OF and select all the actions by click the first one and shift-clicking the last one. Then the script above will do what you want.

CVN 2009-09-04 07:24 AM

Yes, Curt, it if selected, it will act as wanted.... but it is not handy to keep all due items selected at all times ;-)

I dont know about OF scripting, but If it is possible to take all tasks from an inactive perspecitve, is this a way to get the proper tasks together... then the display part still remains.

I have found theese, but cannot make them work:

[url]http://rany.posterous.com/using-omnifocus-with-geektool[/url]
[url]http://concisionandconcinnity.blogspot.com/2009/06/plaintext-task-list-from-omnifocus-with.html[/url]

The last one seems to be the right way, but gives an error:
"OmniFocus got an error: Can’t get name of value of tree 1 of content of document window id 4338 of document id "oi_WtYRN0cI"."

curt.clifton 2009-09-04 11:22 AM

[QUOTE=CVN;66106]Yes, Curt, it if selected, it will act as wanted.... but it is not handy to keep all due items selected at all times ;-)

I dont know about OF scripting, but If it is possible to take all tasks from an inactive perspecitve, is this a way to get the proper tasks together... then the display part still remains.
[/QUOTE]

There's no automatic way in OF to get the items of a perspective without displaying the perspective.

CVN 2009-09-04 11:45 AM

OK. As mentioned, I do not know much about the scripting possibilities.

If you figure it out it will be much appreciated!

I have tried to modify the listet scripts, but with no luck.

kened 2009-09-05 06:40 AM

that is SOOO cool. big up.

IdeaSandbox 2009-11-12 01:55 AM

Fathom - that's a great script.

Is there a way to change the script to do two things

(1) show me everything in my "Due" perspective?
(2) have it run w/o OmniFocus having to be open?


I know this original post was about a focus on the most important thing...

But I'm hoping to keep what is due soon and due this week. If the app is open, it is real easy to view the window to look at the list - but if I want to make that list persistent on my desktop with GeekTool... what do you think?

Thanks for your help!

- Paul

Harry 2009-12-10 10:07 AM

[QUOTE=IdeaSandbox;69617]Is there a way to change the script to do two things

(1) show me everything in my "Due" perspective?
(2) have it run w/o OmniFocus having to be open?

- Paul[/QUOTE]

Actually, you might be better off tweaking one of the scripts from [URL="http://forums.omnigroup.com/showpost.php?p=68821&postcount=7"]this post[/URL].

I use the ListFlagged script myself and it works perfectly. There's a script there for tasks starting today. It could probably be tweaked to show tasks due today, and possibly even for tasks due this week. I know for a fact that you can get it to list the due dates by each item because the ListFlagged script does just that.

Technically OmniFocus has to be open for the script to refresh. I leave the app open but hidden (I use Spirited Away), that way the script can refresh without the OF window getting in my way. Since I use Anxiety as my HUD for OF, I rarely even look at the OF window when I'm in "doing" mode; avoids me spending time "fiddling".

Edit: Upon further inspection I suspect the cause for the issue with Curt's script was the aforementioned Spirited Away. Inactivating it and then reactivating it seemed to do the trick.

gcrump 2009-12-11 06:34 AM

This is a great script and use of GeekTool. Thanks everyone!

disorganized5 2010-12-12 05:07 AM

I don't know anything about scripting. Just found GeekTool by accident and winging it by the seat of my pants. This script is awesome. Thank you Cliff and Fathom!!

A total newbie at this was actually able to use it.:-)

RobTrew 2010-12-12 01:02 PM

For a simple GeekTool list of selected actions, my preference is to skip truncation and use an ordinary bullet ( • )

The following seems to suffice:

[CODE]property pPrefix : "• "
property plngPrefix : length of pPrefix

on run
tell application id "com.apple.systemevents"
if (count of (processes where creator type is "OFOC")) < 1 then return
end tell

tell application id "com.omnigroup.OmniFocus"
tell front document window of front document
set my text item delimiters to return & pPrefix
set str to pPrefix & name of (selected trees of content) as string
if length of str = plngPrefix then ¬
set str to pPrefix & name of (selected trees of sidebar) as string
set my text item delimiters to space
end tell
end tell
return str
end run
[/CODE]

RobTrew 2010-12-12 01:49 PM

[QUOTE=IdeaSandbox;69617]
Is there a way to ... do two things

(1) show me everything in my "Due" perspective?
(2) have it run w/o OmniFocus having to be open?
[/QUOTE]

The following script should work even if OF is not running.

This draft lists all uncompleted tasks with a due date before the current system time. (A comment shows how to adjust this to to list tasks with a due date < now + N * days).

It seems to be working fine with GeekTool on my system.

[CODE]property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"
property pEOR : "<eor>"
property pFldDelim : "<fldelim>"
property pdteBase : missing value
property plstResults : {}

on run
set strNow to AS2SQLDate(current date)
-- OR A VARIANT OF: set strNow to AS2SQLDate(current date + (2 * days))
set strSQL to "select name, " & quoted form of pEOR & ¬
" from task where dateCompleted is null and effectiveDateDue < " & strNow & " order by effectiveDateDue"
RunSQL(strSQL)

set text item delimiters to return & "• "
set strList to "• " & plstResults as string
set text item delimiters to space
set plstResults to {}
strList
end run

on RunSQL(strSQL)
set strCmd to "sqlite3 -separator '" & pFldDelim & "' " & pstrDBPath & space & quoted form of strSQL
set text item delimiters to pFldDelim & pEOR & return -- strip out the end of line \r as well as the record delimiter
set plstResults to text items 1 thru -2 of ((do shell script strCmd) & return)
end RunSQL

on AS2SQLDate(varDate)
if pdteBase is missing value then
set pdteBase to current date
tell pdteBase
set {its year, its month, its day, its time} to {2001, 1, 1, 0}
end tell
end if
(varDate - pdteBase) as string
end AS2SQLDate

[/CODE]

RobTrew 2010-12-12 04:46 PM

Alternatively, for a GeekTool list of Next Actions (displaying even when OmniFocus is not running):

[CODE]property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"
property pEOR : "<eor>"
property pFldDelim : "<fldelim>"

property plstResults : {}

on run
set strSQL to "select name, " & quoted form of pEOR & ¬
" from projectinfo p join task t on p.nexttask=t.persistentidentifier order by dateDue"

RunSQL(strSQL)

set text item delimiters to return & "• "
set strList to "• " & plstResults as string
set text item delimiters to space
set plstResults to {}
strList
end run

on RunSQL(strSQL)
set strCmd to "sqlite3 -separator '" & pFldDelim & "' " & pstrDBPath & space & quoted form of strSQL
set text item delimiters to pFldDelim & pEOR & return -- strip out the end of line \r as well as the record delimiter
set plstResults to text items 1 thru -2 of ((do shell script strCmd) & return)
end RunSQL

[/CODE]

RobTrew 2010-12-13 03:33 AM

FWIW the Sqlite scripts above (which do not require OmniFocus to be running), are fairly fast and inexpensive operations, and I am enjoying the panoptic clarity of running several GeekTool shell panels (refreshed at c. 10-30s intervals) on my desktop:

[IMG]http://farm6.static.flickr.com/5050/5277441501_9a079b0e0e_o.jpg[/IMG]

[B]Tip 1[/B]: The current selection list probably needs a fairly frequent refresh setting, like 10s. If, however, you would like to put the others on much less frequent refresh cycles, but still have the option of an instant refresh on demand, you can use something like FastScripts or Keyboard Maestro to assign a keystroke to the following script:

[CODE]tell application id "org.tynsoe.geektool3"
refresh all
end tell[/CODE]

[B]Tip 2[/B] You can toggle the GeekTool display on and off by attaching a script like this to a keystroke:

[CODE]property pGroupName : "Default Group"

tell application id "org.tynsoe.geektool3"
tell (first group where name = pGroupName)
set visible to not visible
end tell
end tell[/CODE]

(I have posted a generic script for display custom OF actions lists in Geektool in [URL="http://forums.omnigroup.com/showthread.php?t=19419"]another thread[/URL]).

[COLOR="White"]--[/COLOR]


All times are GMT -8. The time now is 08:44 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.