PDA

View Full Version : Auto-highlight past dates?


mprewitt
2007-02-08, 07:28 AM
I have OO3. Is there a way to highlight dates in an outline dynamically (automatically) that are earlier than the current date? In other words, highlight dates that are in the past?

I have three columns in several of my OO3 task lists, and the third column is a "due date." I would like to make the text in that column red if the date is in the past.

DerekM
2007-02-08, 11:59 AM
No, this is *not* an ability OmniOutliner has. You could use an AppleScript to do it though. This might be something possible in a future release.

mprewitt
2007-02-09, 11:52 AM
No, this is an ability OmniOutliner has. You could use an AppleScript to do it though. This might be something possible in a future release.

I'll assume from the context that you mean this is NOT an ability OO has.

Take my vote for adding this feature to a future version. In the meantime, I shall see about an AppleScript solution....

gcrump
2007-06-25, 08:23 PM
I know this is an older thread but here is the script that I cam up with to solve this problem. I am open to any ideas for improvement:

repeat with theRow in (every row whose state is unchecked)
set theDate to value of cell "Due Date" of theRow
if theDate is not missing value then
remove every named style of style of theRow from named styles of style of theRow
set myStyle to named style ("Overdue")
if theDate < TodaysDate then
add myStyle to named styles of style of theRow
else
remove myStyle from named styles of style of theRow
end if
else
-- missing value but unchecked (means I forgot to set a date)
remove every named style of style of theRow from named styles of style of theRow
set myStyle to named style ("Blankdue")
add myStyle to named styles of style of theRow
end if
end repeat

Lizard
2007-06-25, 10:01 PM
I'm curious...why do you remove all the existing styles before adding the Overdue or Blankdue style?

gcrump
2007-06-26, 03:50 AM
Mostly because I don't know what I'm doing :)

As I recall I was getting a error message without it being in there. Is there a better way.

Lizard
2007-06-26, 10:03 PM
Hmmm....you're right. It does give an "NSInternalScriptError". Looks like that happens because the style you're trying to add is already in the styles for that row. I'm pretty sure that's an AppleScript limitation, but we do have an open bug for it.

As long as there's no other style info you need to keep, just throwing them all away is probably a reasonable shortcut.

To really work around this issue, you'd want to check if the style you're about to apply is already in the list, and if so, don't reapply it. You'd also need to take out the style that's no longer true. So yeah, lots more complicated.

Nice shortcut!

gcrump
2007-06-27, 04:16 AM
To really work around this issue, you'd want to check if the style you're about to apply is already in the list, and if so, don't reapply it. You'd also need to take out the style that's no longer true. So yeah, lots more complicated.

Nice shortcut!


Just got lucky, sometimes brute force is easier. Thanks though.