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)

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 03:14 PM.

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