The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Forecast view listings for Mac desktop (http://forums.omnigroup.com/showthread.php?t=25238)

RobTrew 2012-08-21 01:07 PM

Forecast view listings for Mac desktop
 
1 Attachment(s)
The [B]Forecast[/B] view on the iPad version of OmniFocus is generally found very useful, often requested for the Mac version, and doubtless planned or in progress for Mac OF 2.

In the meanwhile, as a stop-gap, here are the first rough drafts of shell scripts which can be used in NerdTool or GeekTool to get 7 day Forecast listings on the Mac Desktop, even when OmniFocus and iCal are not running.

There are three draft shell scripts:[LIST=1][*]Due in the next seven days (by day of week)[*]Calendared in the next seven days (by day of week, from iCal)[*]Starting in the next seven days (by day of week)[/LIST]
Note that in NerdTool (which I personally use because it is a bit less resource-hungry) you should set the encoding to UTF-8.

[IMG]http://forums.omnigroup.com/attachment.php?attachmentid=2500&stc=1&d=1345583166[/IMG]

RobTrew 2012-08-21 01:07 PM

Due in the next seven days (by day of week)

[CODE]#!/bin/sh
# Ver 0.05
# Lists the specifics of overdue items
# Changes the handling of time zones
OFOC="com.omnigroup.OmniFocus"
if [ ! -d "$HOME/Library/Caches/$OFOC" ]; then OFOC=$OFOC.MacAppStore; fi
OFQUERY="sqlite3 $HOME/Library/Caches/$OFOC/OmniFocusDatabase2"
TODAY=$(date -v0H -v0M -v0S +%s) #Midnight at the start of today: set the time component to 00:00
NOW=$(date +%s) # the date command automatically allows for daylight savings like BST in the UK
DAY=86400;
NEXTWEEK=$(($NOW + (7 * $DAY)));
YESTERDAY=$(($NOW - $DAY));

ZONERESET=$(date +%z | awk '
{if (substr($1,1,1)!="+") {printf "+"} else {printf "-"} print substr($1,2,4)}')
YEARZERO=$(date -j -f "%Y-%m-%d %H:%M:%S %z" "2001-01-01 0:0:0 $ZONERESET" "+%s")
DUE="($YEARZERO + t.effectiveDateDue)";
DAY=86400

JOIN="(((task tt left join projectinfo pi on tt.containingprojectinfo=pi.pk) t
left join task p on t.task=p.persistentIdentifier)
left join context c on t.context = c.persistentIdentifier)
left join folder f on t.folder=f.persistentIdentifier"

MATCHES="status='active' and (t.dateCompleted is null and $DUE < ($NOW + (7 * $DAY))) and ($DUE >= $TODAY)"
OVERMATCHES="status='active' and (t.dateCompleted is null) and ($DUE < $TODAY)"
NEXTMATCHES="(status='active') and ($DUE < ($NOW + (14 * $DAY))) and ($DUE > ($NOW + (7 * $DAY)))"
read overTOTAL weekTOTAL foreTOTAL <<< $($OFQUERY "
SELECT count(*) FROM $JOIN WHERE $OVERMATCHES;
SELECT count(*) FROM $JOIN WHERE $MATCHES;
SELECT count(*) FROM $JOIN WHERE $NEXTMATCHES;
")

printf "DUE (%s in coming week)\n\n" "$weekTOTAL"

$OFQUERY "
SELECT strftime('%w|%m|%d|%Y|%H:%M',$DUE, 'unixepoch'), p.name, t.name
FROM $JOIN
WHERE $MATCHES
ORDER BY t.effectiveDateDue, f.name, p.name, c.name
" | awk '
function monthname(i) {
return substr("JanFebMarAprMayJunJulAugSepOctNovDec",((i-1)*3)+1,3)
}
function dayname(i) {
return substr("SunMonTueWedThuFriSat",(i*3)+1,3)
}
BEGIN {FS="\|"; day=0; year=0; prj=0}
{
if (day!=$3) {day=$3;
print dayname($1), monthname($2), $3, $4
}
if (prj!=$6) {prj=$6;
if (prj!="") {print " " prj ":"}
}
print " •", $5, $7
}'
printf "\nOVERDUE (%s tasks)\n\n" "$overTOTAL"

$OFQUERY "
SELECT strftime('%w|%m|%d|%Y|%H:%M',$DUE, 'unixepoch'), p.name, t.name
FROM $JOIN
WHERE $OVERMATCHES
ORDER BY t.effectiveDateDue, f.name, p.name, c.name
" | awk '
function monthname(i) {
return substr("JanFebMarAprMayJunJulAugSepOctNovDec",((i-1)*3)+1,3)
}
function dayname(i) {
return substr("SunMonTueWedThuFriSat",(i*3)+1,3)
}
BEGIN {FS="\|"; day=0; year=0; prj=0}
{
if ($7 != "") {
if (day!=$3 || year!=$4) {day=$3; year=$4;
print "Was due " dayname($1), monthname($2), $3, $4
}
if (prj!=$6) {prj=$6;
if (prj!="") {print " " prj ":"}
}
print " •", $5, $7
}
}'
printf "\n(%s due in following week)\n" "$foreTOTAL"[/CODE]

RobTrew 2012-08-21 01:09 PM

Calendared in the next seven days (by day of week, from iCal)

[CODE]#!/bin/sh
# ver 0.15
# Allows for flexible horizon - edit value of FIRSTDAY and LASTDAY in first line
# FIRSTDAY=0 starts from today (midnight last night)
# FIRSTDAY=1 is from midnight tonight, etc.

FIRSTDAY=0
LASTDAY=7
OSXVER=$(sw_vers -productVersion | cut -d . -f 2)

if [ $OSXVER -eq 7 ]; then
CALTABLE=zicselement
REMCODE=24
LOCN=zlocation1
elif [ $OSXVER -ge 8 ]; then
CALTABLE=zicselement
REMCODE=24
LOCN=zlocation
else
CALTABLE=zcalendaritem
REMCODE=9
LOCN=zlocation
fi

NOW=$(date +%s)
ZONERESET=$(date +%z | awk '
{if (substr($1,1,1)!="+") {printf "+"} else {printf "-"} print substr($1,2,4)}')
YEARZERO=$(date -j -f "%Y-%m-%d %H:%M:%S %z" "2001-01-01 0:0:0 $ZONERESET" "+%s")
STARTDATE="($YEARZERO + zstartdate)";
ENDDATE="($YEARZERO + zenddate)";
DAY=86400;
HORIZON=$(($NOW + ($LASTDAY * $DAY)));

TODAY=$(date -v0H -v0M -v0S +%s) #Midnight: set the time component to 00:00
START=$(($TODAY+($FIRSTDAY * $DAY)))

MATCHES="(z_ent!=$REMCODE) and ($STARTDATE >= $START) and ($STARTDATE < $HORIZON)"
TOTAL=$(sqlite3 $HOME/Library/Calendars/Calendar\ Cache "
SELECT count(*) FROM $CALTABLE WHERE $MATCHES")

if [ $FIRSTDAY -eq 0 ]; then
printf "%s\n\n" "CALENDAR ($TOTAL events in next $LASTDAY days)"
else
printf "%s\n\n" "CALENDAR ($TOTAL events between $FIRSTDAY and $LASTDAY days ahead)"
fi

# %w day of week, %m month, %d day of month, %H %M Hour Month
sqlite3 $HOME/Library/Calendars/Calendar\ Cache "
SELECT strftime('%w|%m|%d|%H:%M',$STARTDATE, 'unixepoch'),
ztitle, replace($LOCN,'
',' '), zisallday, strftime('%H:%M',$ENDDATE, 'unixepoch')
FROM $CALTABLE
WHERE $MATCHES
ORDER BY zstartdate
" | awk '
function monthname(i) {
return substr("JanFebMarAprMayJunJulAugSepOctNovDec",((i-1)*3)+1,3)
}
function dayname(i) {
return substr("SunMonTueWedThuFriSat",(i*3)+1,3)
}
BEGIN {FS="\|"; mday=0; wkday=0}
{
if (mday!=$3) {mday=$3; wkday=$1;
print dayname(wkday), monthname($2), mday
}
printf " • "; if ($7!=1) {printf $4 "-" $8 " "}; printf $5
if ($6!="") {printf " [" $6 "]"}
printf "\n"
}'[/CODE]

RobTrew 2012-08-21 01:09 PM

Starting in the next seven days (by day of week)

[CODE]#!/bin/sh
# Ver 0.2
OFOC="com.omnigroup.OmniFocus"
if [ ! -d "$HOME/Library/Caches/$OFOC" ]; then OFOC=$OFOC.MacAppStore; fi
OFQUERY="sqlite3 $HOME/Library/Caches/$OFOC/OmniFocusDatabase2"

TODAY=$(date -v0H -v0M -v0S +%s) #Midnight at the start of today: set the time component to 00:00
NOW=$(date +%s) # the date command automatically allows for daylight savings like BST in the UK
DAY=86400;
NEXTWEEK=$(($NOW + (7 * $DAY)));
YESTERDAY=$(($NOW - $DAY));

ZONERESET=$(date +%z | awk '
{if (substr($1,1,1)!="+") {printf "+"} else {printf "-"} print substr($1,2,4)}')
YEARZERO=$(date -j -f "%Y-%m-%d %H:%M:%S %z" "2001-01-01 0:0:0 $ZONERESET" "+%s")
STARTS="($YEARZERO + t.effectiveDateToStart)";

MATCHES="($STARTS < ($NOW + (7 * $DAY))) and ($STARTS >= $TODAY)"
#TOTAL=$($OFQUERY "SELECT count(*) FROM task t WHERE $MATCHES")
read weekTOTAL foreTOTAL <<< $($OFQUERY "
SELECT count(*) FROM task t WHERE $MATCHES;
SELECT count(*) FROM task t
WHERE ($STARTS < ($NOW + (14 * $DAY))) and ($STARTS > ($NOW + (7 * $DAY)));
")

echo "STARTING ($weekTOTAL in coming week)
"
$OFQUERY "
SELECT strftime('%w|%m|%d|%H:%M',$STARTS, 'unixepoch'), p.name, t.name
FROM (((task tt left join projectinfo pi on tt.containingprojectinfo=pi.pk) t
left join task p on t.task=p.persistentIdentifier)
left join context c on t.context = c.persistentIdentifier)
left join folder f on t.folder=f.persistentIdentifier
WHERE status='active' and $MATCHES
ORDER BY t.effectiveDateToStart, f.name, p.name, c.name
" | awk '
function monthname(i) {
return substr("JanFebMarAprMayJunJulAugSepOctNovDec",((i-1)*3)+1,3)
}
function dayname(i) {
return substr("SunMonTueWedThuFriSat",(i*3)+1,3)
}
BEGIN {FS="\|"; wkday=0; prj=0}
{
if (wkday!=$1) {wkday=$1;
print "Starting " dayname(wkday), monthname($2), $3
}
if (prj!=$5) {prj=$5;
if (prj!="") {print " " prj ":"}
}
printf " • "
if ($4!="00:00") {printf "at " $4 " "}; print $6
}'
echo "
($foreTOTAL starting in following week)"[/CODE]

RobTrew 2012-09-02 07:47 PM

[QUOTE=RobTrew;113776]Calendared in the next seven days (by day of week, from iCal)[/QUOTE]

Fixed a bug (ver 9, above) involving multi-line location fields.

RobTrew 2012-09-04 01:50 AM

[QUOTE=RobTrew;113776]Calendared in the next seven days (by day of week, from iCal)[/QUOTE]


Edited the iCal script above to make the horizons flexible.
The integer values in the first two lines can be adjusted:

Defaults to the coming week:
[CODE]# FIRSTDAY=0 starts from today (midnight last night)
#FIRSTDAY=1 is from midnight tonight, and so on ...
FIRSTDAY=0
LASTDAY=7[/CODE]

but can be simply edited, for example for the following week:
[CODE]FIRSTDAY=8
LASTDAY=14[/CODE]

kingsinger 2012-10-03 02:17 PM

Tried this out. Cool! But I seem to be getting some unexpected items mixed into the one that shows items that are due and overdue.

Does the script filter out items in projects that have been dropped? I store templates in a dropped state, so they are out of the way.

kingsinger 2012-10-03 02:30 PM

It also seems like it pulls items underneath a project that has been marked completed. So if you marked the project completed without marking each individual item underneath it completed, then these items are displayed as overdue.

KS

kingsinger 2012-10-03 02:44 PM

It would also be great if the dates had the year as well. It's embarrassing, but some overdue items are very over due. This view is actually helping me to get rid of some of those <g>.

RobTrew 2012-10-04 02:07 PM

To many of mine are showing as imminently overdue so I'll have to leave that as an exercise for the reader, for the moment :-)

For the display of years with [I]strftime[/I]:
[URL="http://www.sqlite.org/lang_datefunc.html"]http://www.sqlite.org/lang_datefunc.html[/URL]

To eliminate uncompleted tasks of completed projects, I think you could begin by trying to expand [I]t.dateCompleted is null[/I] in MATCHES to something like [I] p.status = 'active' and t.dateCompleted is null[/I]

kingsinger 2012-10-07 11:51 AM

[QUOTE=RobTrew;115573]To many of mine are showing as imminently overdue so I'll have to leave that as an exercise for the reader, for the moment :-)

For the display of years with [I]strftime[/I]:
[URL="http://www.sqlite.org/lang_datefunc.html"]http://www.sqlite.org/lang_datefunc.html[/URL]

To eliminate uncompleted tasks of completed projects, I think you could begin by trying to expand [I]t.dateCompleted is null[/I] in MATCHES to something like [I] p.status = 'active' and t.dateCompleted is null[/I][/QUOTE]

FWIW, I don't think the calendar script is pulling in repeated events from iCal. This is true both of a native iCal calendar I have and also a CalDav google calendar I'm subscribed to.

Beyond that, thanks for your feedback/suggestions. Sadly, most of this sqlite scripting stuff is beyond me. I tried changing that Matches= statement as you suggested and then adjusting the parenthesis as that seemed necessary too. But when I did this, no tasks showed anymore. So either more is needed, or more likely, I did something wrong.

RobTrew 2012-10-07 03:06 PM

I've made a couple of quick edits to the 'coming week' view above to include years and insert a [I]status='active'[/I] clause.

Haven't taken a look at how repeating tasks are handled in the iCal database. Unlikely to get to that this week.

kingsinger 2012-10-07 11:40 PM

[QUOTE=RobTrew;115693]I've made a couple of quick edits to the 'coming week' view above to include years and insert a [I]status='active'[/I] clause.

Haven't taken a look at how repeating tasks are handled in the iCal database. Unlikely to get to that this week.[/QUOTE]

Thanks Robtrew! That seems to have worked.

dbyler 2012-10-08 12:49 PM

Rob,

This is awesome! For those interested in excluding certain projects from the output... just change

[CODE]
read overTOTAL weekTOTAL foreTOTAL <<< $($OFQUERY "
SELECT count(*) FROM $JOIN WHERE $OVERMATCHES;
SELECT count(*) FROM $JOIN WHERE $MATCHES;
SELECT count(*) FROM $JOIN WHERE $NEXTMATCHES;
")
[/CODE]

to

[CODE]
EXCLUSIONS="AND p.name NOT IN ('Work Recurring', 'Daily')"
read overTOTAL weekTOTAL foreTOTAL <<< $($OFQUERY "
SELECT count(*) FROM $JOIN WHERE $OVERMATCHES $EXCLUSIONS;
SELECT count(*) FROM $JOIN WHERE $MATCHES $EXCLUSIONS;
SELECT count(*) FROM $JOIN WHERE $NEXTMATCHES $EXCLUSIONS;
")
[/CODE]

In this example I've excluded tasks from the "Work Recurring" and "Daily" projects.

Note: this only works for the DUE script. I'm tinkering with the START script but it's not just a copy-paste operation.

/d

kingsinger 2012-10-09 05:04 PM

If I wanted to see the same info from the Due Script in a text file instead in a geektool gadget thing, what would I need to do?

RobTrew 2012-10-09 11:24 PM

[QUOTE=kingsinger;115792]If I wanted to see the same info from the Due Script in a text file instead in a geektool gadget thing, what would I need to do?[/QUOTE]

You can run it as a shell script. Googling [I]"OS X" run shell script[/I] will take you to various options but a traditional approach might be to save the script as a text file with the extension .sh and then make it executable with the [I]chmod[/I] command in Terminal.app

If you save it in your user directory as [I]ofdue.sh[/I] you could make it executable and test it with sth like:[LIST][*]chmod u+x ofdue.sh[*]$HOME/ofdue.sh[/LIST]
Then, to generate and inspect a text file containing the output:[LIST][*]$HOME/ofdue.sh > results.txt[*]cat results.txt[/LIST]

RobTrew 2012-10-09 11:35 PM

1 Attachment(s)
If you want an automatically updated text file (for example whenever the SQLite cache changes), it might be worth experimenting with Hazel.

[COLOR="White"]--[/COLOR]
[IMG]http://forums.omnigroup.com/attachment.php?attachmentid=2588&stc=1&d=1349858466[/IMG]

kingsinger 2012-10-10 03:00 PM

I've got Hazel on my system, so that sounds like an excellent approach to try.

Thanks!

kingsinger 2012-10-10 03:04 PM

One other thing to note about the Due Script. All seems to work as anticipated now, except for one thing:

Periodically in the list of tasks I get a line item that reads "Was due Sun Jan"

It has no date and year and no description of the task.

Wondering if this reflects some sort of corruption in my database, or something odd with the script?

KS

kingsinger 2012-10-10 08:13 PM

Got the Hazel rule to work. Nice. Now the text file sits in NV Alt, so it gets sync to Simplenote and with luck I can see it from Android phone and elsewhere.

RobTrew 2012-10-10 11:36 PM

[QUOTE=kingsinger;115845]Periodically in the list of tasks I get a line item that reads "Was due Sun Jan" It has no date and year and no description of the task.
[/QUOTE]

Ver 005 above should fix that, I think.

kingsinger 2012-10-11 10:48 AM

How difficult would it be to change the output of the due script, so that it breaks the items up as follows:

Due in the coming week

Less than x months Overdue

More than x months Overdue

Maybe this isn't relevant to a lot of people, but at least for me, the most immediately overdue items tend to be the most important ones for me to see. If a task is pretty stale, I may not feel I can delete it, but if it has sat for a long time it also may not be as urgently overdue as some of the newer tasks in the overdue list.

As things are presently constituted, if you have a rather long list of overdue items, as I am not so proud to say that I do, the most recent overdue items sort to the bottom of the list. If the list is long enough <g>, they aren't even visible on my screen, because the list runs off of it.

That being said, within a overdue in the last x month view, I wouldn't mind seeing the most overdue item first (as things are now).

I know that at a certain point, if one want lots of sorting and filtering options, one may as well just open up OF.

But between this script, hazel, dropbox, and simplenote, I think I may have a system that allows me to view my tasks other places (like on my android phone). So having a little more control over the organization would be helpful.

kingsinger 2012-10-11 11:03 AM

[QUOTE=RobTrew;115855]Ver 005 above should fix that, I think.[/QUOTE]

Yes, I think it has fixed it.

kingsinger 2012-10-11 11:34 AM

[QUOTE=RobTrew;115855]Ver 005 above should fix that, I think.[/QUOTE]

Spoke too soon. Added a few items, and Sun Jan is back.

KS

kingsinger 2012-10-11 03:42 PM

[QUOTE=kingsinger;115903]Spoke too soon. Added a few items, and Sun Jan is back.[/QUOTE]

Looks like this may happen when it is trying to pull out tasks that are nested down a couple of levels.

I added a project using Curt Clifton's Populate Template AS. It's a relatively involved one. Then I added due dates to a couple of items. Now in my text file, I see two iterations of the project header is the "Due" section, but neither of the tasks are listed. Instead, it looks like this:

[CODE]
ProjectName:
*15:00
Sun Jan

[/CODE]

FWIW, 15:00 is the default time I've set for due date reminders.

RobTrew 2012-10-11 11:54 PM

[QUOTE=kingsinger;115917]Looks like this may happen when it is trying to pull out tasks that are nested down a couple of levels.[/QUOTE]

Can't reproduce that problem here with deeply nested tasks. (The Sqlite tables are flat, as it happens)

[QUOTE=kingsinger;115917]I added a project using Curt Clifton's Populate Template AS. It's a relatively involved one. Then I added due dates to a couple of items. Now in my text file, I see two iterations of the project header is the "Due" section, but neither of the tasks are listed.[/QUOTE]

Any unusual characters in the text of these actions: end of line breaks (linefeeds) for example, or pipe characters "|" ? Anything else unusual ?

kingsinger 2012-10-12 01:59 AM

[QUOTE=RobTrew;115931]Can't reproduce that problem here with deeply nested tasks. (The Sqlite tables are flat, as it happens)



Any unusual characters in the text of these actions: end of line breaks (linefeeds) for example, or pipe characters "|" ? Anything else unusual ?[/QUOTE]

There's a colon. There's also a comma. Otherwise, it's just letters.

The hierarchy is as follows:

Project Name
Phase 1: Admin
Make Client File: Project Name


In the example above, "Make Client File: Project Name" is not getting pulled out into the text file.

RobTrew 2012-10-12 03:51 AM

If you'd like to send me an [URL="http://forums.omnigroup.com/showpost.php?p=100455&postcount=4"]OPML [/URL]version of that project (or a similar one which is not getting through) , I'll try to take a look at it over the weekend.

(When you use that older OPML script, just select the top-level node of the outline you want to export - the sub-tree will be exported with it)

kingsinger 2012-10-12 03:20 PM

Will the OPML script work with 10.6.8? Or does it use the newer version of Python?

danielcompton 2012-10-15 02:25 AM

Hi there

I have updated the start date script to order it by start date, not due date. This was giving me a strange looking list with the dates all out of order.

The change is on line 34:
from
ORDER BY t.effectiveDateDue, f.name, p.name, c.name
to
ORDER BY t.effectiveDateToStart, f.name, p.name, c.name

RobTrew 2012-10-15 10:14 AM

Well caught.

Amended above.

kingsinger 2012-10-16 12:06 AM

I think there is still a typo in that start date script. Line 34 now reads as follows:

"ORDER BY ORDER BY t.effectiveDateToStart, f.name, p.name, c.name"

Should one of those ORDER BY statements be deleted?

kingsinger 2012-10-16 12:22 AM

Anyway to exclude completed items from the Starting This Week script? I completed a couple of tasks that started today, but they are still showing in the list.

RobTrew 2012-10-16 04:43 AM

Thanks. Edited above.

Re time, the convention of the scripts is to define 'today' as starting last night at midnight.

It should, I think, be possible to decipher and tailor the boundaries..

kingsinger 2012-10-16 09:32 AM

[QUOTE=RobTrew;116114]Thanks. Edited above.

Re time, the convention of the scripts is to define 'today' as starting last night at midnight.

It should, I think, be possible to decipher and tailor the boundaries..[/QUOTE]

Not sure if you were responding to my question or one above. I tried adding "t.dateCompleted is null" to the matches statement in the start date script. It removed the items that were completed, but for some reason it also removed the start date header for the first task that remained after that.

I guess that's not the way to accomplish pulling completed tasks out of this list.

BrainInside 2012-10-17 07:03 PM

Hey
Could somebody make a screen shoot of how does your script for iCal look? I totally don't know what I suppose to do with that code, but first I would want to know what it really does.

Thanks a lot

RobTrew 2012-10-18 04:40 AM

A Geektool site may prove helpful on that one.
[URL="http://www.macosxtips.co.uk/geeklets/productivity/ical-reminders/"]http://www.macosxtips.co.uk/geeklets/productivity/ical-reminders/[/URL]

BrainInside 2012-10-18 02:43 PM

[QUOTE=RobTrew;116257]A Geektool site may prove helpful on that one.
[URL="http://www.macosxtips.co.uk/geeklets/productivity/ical-reminders/"]http://www.macosxtips.co.uk/geeklets/productivity/ical-reminders/[/URL][/QUOTE]

I have no idea how it relates to OmniFocus

kingsinger 2012-10-18 03:30 PM

[QUOTE=BrainInside;116290]I have no idea how it relates to OmniFocus[/QUOTE]

Geektool is a utility that places information on your desktop. The script that Robtrew wrote queries the OF database (or in the case of ical you ical database), and then tells geektool to put that information on your desktop.

If you learn a little bit about geektool, you'll probably have a better understanding of what is possible based on Rob's script. The script itself pretty much just outputs a text list of dates and events, in the case of the ical script.

But using Geektool, you can then take this raw text output and format certain aspects of it.

For example, I made the color of my text white and changed the font size. Otherwise, I kept things quite simple. I just wanted a raw list of info on the desktop of one of my three monitors, so it was always there staring me in the face.

Other people create much fancier stuff.

Basically, you download geektool and install it. Then you create a widget thing to sit on your desktop. From there, you'll be given a preference dialog box. One option is to insert the content of a bash script, which will then output info to your desktop. Take the text of one of Rob's scripts, and past it into the part of the preferences. place the widget thing on your desktop. It should update. Then you'll see the info at has collected form its query.

I'm sorry if this isn't a super clear explanation. I'm not in a position to take screenshots, as I'm away from my Mac right now. But hopefully it will give you enough background that you can take it the rest of the way yourself using the link Rob provided.

KS

BrainInside 2012-10-18 05:39 PM

@kingsinger
I think I get the idea, but I was thinking it is for OmniFocus forecast option on MacOS like it is on iPhone.

If you will be able to get a screen shot I would appreciate. Maybe I'm getting it wrong, however I think it will have no use for me.

Thanks

kingsinger 2012-10-18 09:37 PM

[QUOTE=BrainInside;116295]@kingsinger
I think I get the idea, but I was thinking it is for OmniFocus forecast option on MacOS like it is on iPhone.

If you will be able to get a screen shot I would appreciate. Maybe I'm getting it wrong, however I think it will have no use for me.

Thanks[/QUOTE]

It isn't really like Forecast view on the iPhone. It's just a way of getting a layout on your desktop that contains similar information to the information contained in the forecast view on the iPhone.

It's not an interactive list. It's simply a text list of items starting in the next x days (or due in the next x days). When you make a change in Omnifocus, the next time the script is refreshed, these changes will be reflected on your desktop.

So if you don't keep OF open on your mac all the time, but you'd like to be able to see your task list at a glance by looking at your desktop, these scripts might be worth you while. But if what you really want is something pretty close to the iPhone functionality, this probably isn't what you want.

holyjaw 2012-10-21 07:54 AM

The "Calendared in the next seven days (by day of week, from iCal)" script appears to assume 10.8 Mountain Lion uses the same sqlite3 table schema as Lion. Apparently it doesn't.
[CODE]sqlite3 ~/Library/Calendars/Calendar\ Cache
.tables
.scheme ZICSELEMENT[/CODE] reveals 10.8 has moved rolled back to using 'zlocation'... or at least that's how my Calendar database is after moving from 10.6 > MobileMe > iCloud > 10.8

I've modified the script a bit to add in a check for sw_vers 10.8. It assumes 10.8 and later will retain 'zlocation' as opposed to 'zlocation1'

From line 11:
[CODE]if [ $OSXVER -eq 7 ]; then
CALTABLE=zicselement
REMCODE=24
LOCN=zlocation1
elif [ $OSXVER -ge 8 ]; then
CALTABLE=zicselement
REMCODE=24
LOCN=zlocation
else
CALTABLE=zcalendaritem
REMCODE=9
LOCN=zlocation
fi[/CODE]

RobTrew 2012-10-21 08:56 AM

Thanks – that's very helpful – I haven't seen a 10.8 system yet.

Amended above.

naupaka 2012-10-21 11:38 AM

To exclude projects from the startdate script, change lines 18-20:

[CODE]
MATCHES="($STARTS < ($NOW + (7 * $DAY))) and ($STARTS >= $TODAY)"
#TOTAL=$($OFQUERY "SELECT count(*) FROM task t WHERE $MATCHES")
[/CODE]

to:

[CODE]
MATCHES="($STARTS < ($NOW + (7 * $DAY))) and ($STARTS >= $TODAY)"
#TOTAL=$($OFQUERY "SELECT count(*) FROM task t WHERE $MATCHES")
EXCLUSIONS="AND p.name NOT IN ('Daily Review', 'Weekly Review')"
[/CODE]

and line 34:

[CODE]
left join folder f on t.folder=f.persistentIdentifier
WHERE status='active' and $MATCHES
ORDER BY t.effectiveDateToStart, f.name, p.name, c.name
[/CODE]

to

[CODE]
left join folder f on t.folder=f.persistentIdentifier
WHERE status='active' and $MATCHES $EXCLUSIONS
ORDER BY t.effectiveDateToStart, f.name, p.name, c.name
[/CODE]

[QUOTE=dbyler;115743]Rob,

This is awesome! For those interested in excluding certain projects from the output... just change

[CODE]
read overTOTAL weekTOTAL foreTOTAL <<< $($OFQUERY "
SELECT count(*) FROM $JOIN WHERE $OVERMATCHES;
SELECT count(*) FROM $JOIN WHERE $MATCHES;
SELECT count(*) FROM $JOIN WHERE $NEXTMATCHES;
")
[/CODE]

to

[CODE]
EXCLUSIONS="AND p.name NOT IN ('Work Recurring', 'Daily')"
read overTOTAL weekTOTAL foreTOTAL <<< $($OFQUERY "
SELECT count(*) FROM $JOIN WHERE $OVERMATCHES $EXCLUSIONS;
SELECT count(*) FROM $JOIN WHERE $MATCHES $EXCLUSIONS;
SELECT count(*) FROM $JOIN WHERE $NEXTMATCHES $EXCLUSIONS;
")
[/CODE]

In this example I've excluded tasks from the "Work Recurring" and "Daily" projects.

Note: this only works for the DUE script. I'm tinkering with the START script but it's not just a copy-paste operation.

/d[/QUOTE]

danielcompton 2012-10-29 10:40 PM

Calendar including past items
 
In v 0.15 of the calendar there is a bug where it shows past calendar items. At 19:34, 30/10/12 New Zealand time, it shows calendar items back as far as 11:00 on 29/10/12. It will not show items starting at 10:59 or before.

This is related to the timezone, when I set my computer time to GMT then the calendar shows events starting at midnight last night (as expected).

I am running OS X 10.7, is my time zone not being picked up and adjusted for in the script?

RobTrew 2012-10-30 03:00 AM

[QUOTE=danielcompton;116769]I am running OS X 10.7, is my time zone not being picked up and adjusted for in the script?[/QUOTE]

Thanks for picking this up – I wonder if there is a daylight savings subtlety at work.

If you enter this in Terminal.app on your system, do you get a correct local time adjustment ?

[CODE]date +%z | awk '{if (substr($1,1,1)!="+") {printf "+"} else {printf "-"} print substr($1,2,4)}'[/CODE]

or perhaps more to the point, what does this return, and does it look right ?
[CODE]date +%z[/CODE]

danielcompton 2012-10-30 06:05 PM

[QUOTE=RobTrew;116779]
[CODE]date +%z | awk '{if (substr($1,1,1)!="+") {printf "+"} else {printf "-"} print substr($1,2,4)}'[/CODE]
[/QUOTE]

[CODE]-1300[/CODE]

[QUOTE]
or perhaps more to the point, what does this return, and does it look right ?
[CODE]date +%z[/CODE][/QUOTE]

[CODE]+1300[/CODE]

NZ daylight savings time is 13 hours ahead of GMT. I'm not sure which of the two is correct but they aren't matching up. What do you think?

BrainInside 2012-10-30 06:12 PM

can anybody make a screenshot of that? I totally don't understand what you guys write here... not everybody is so smart to be a programmer ;-)

RobTrew 2012-10-31 12:29 AM

[QUOTE=danielcompton;116813][CODE]-1300[/CODE]

[CODE]+1300[/CODE]

NZ daylight savings time is 13 hours ahead of GMT. I'm not sure which of the two is correct but they aren't matching up. What do you think?[/QUOTE]

They are technically both working - the former derives a zone reset by a simple sign-inversion (so that 13 hours are deducted from the GMT value).

In your 10.59 11.00 example, are we looking at late morning, or at 22.59 and 23:00 by 24h reckoning ?

danielcompton 2012-10-31 03:08 PM

It was late morning, e.g. 13 hours before midnight.

The full terminal output is below.

[CODE]
$date +%z | awk '{if (substr($1,1,1)!="+") {printf "+"} else {printf "-"} print substr($1,2,4)}'
-1300
$date +%z
+1300
[/CODE]

RobTrew 2012-10-31 03:16 PM

That's helpful - sounds like the zone reset is inadvertently being applied twice then … I'll have a look at the weekend.


All times are GMT -8. The time now is 10:47 AM.

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