The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Tasks: Days Past Due Thread Tools Search this Thread Display Modes
Is there a way to create a column that will show how many days a task has missed its due date?

Thanks in advanced.
 
Yeah, you can write an Applescript that will fill in the column on command (it will not update dynamically, and you don't want to be editing one of the cells when you run the script). Put the script in the OmniOutliner scripts folder and the Customize Toolbar command will allow you to put a button for it in your toolbar. I don't recall if the ability to make a document-specific toolbar is a OO Pro feature, but if it isn't, that would be even better.

Here's a sample:
Code:
tell application "OmniOutliner"
	tell front document
		set currentDate to (current date)
		
		if title of every column does not contain {"Date due"} then
			display dialog "You need columns named 'Date due' and 'Days overdue' for this script" buttons "Cancel" default button 1
		end if
		if title of every column does not contain {"Days overdue"} then
			display dialog "You need columns named 'Date due' and 'Days overdue' for this script" buttons "Cancel" default button 1
		end if
		
		repeat with myRow in every row
			if (state of myRow is unchecked) then
				set rowDueDate to value of cell "Date due" of myRow
				if (rowDueDate is not missing value) then
					if (currentDate > rowDueDate) then
						set daysOverdue to (currentDate - rowDueDate) / days
					else
						set daysOverdue to missing value
					end if
					set value of cell "Days overdue" of myRow to daysOverdue
				end if
			end if
			
		end repeat
	end tell
end tell
"Date due" should be a column of type Date, and "Days overdue" should be a column of type Number, and both allow some variation in formatting which you should adjust to suit.
Attached Thumbnails
Click image for larger version

Name:	Screen shot 2009-12-29 at 11.26.57 AM.png
Views:	546
Size:	26.7 KB
ID:	1216  
 
Whpalmer4,

Thank you. This is exactly what I'm looking for; however, one problem: I'm new with MACs and weak with Applescript (but strong with Fortran, PERL, and C++), so I'm very willing to learn.

I do not have an "OmniOutliner Scripts" folder in "Applications." The OmniOutliner program is the only thing in Applications.

I am using OO Pro -- had it now for about a week.

I know you explained things below, but I may need some extra hand-holding here because I'm afraid I may waste time trying this and trying that. I've looked at a primer in the OF forum, but nothing that says here's a way that will work if directions are followed exactly.

As I understand, I can create an "OmniOutliner Scripts" folder in the Applications folder. There I put the script you have written and call it anything I want. From there OmniOutliner will know it's there? How to invoke it so the Customize Toolbar knows it is there?

I feel once I get past this point, I'll be able to take off.

Thanks ...


Quote:
Originally Posted by whpalmer4 View Post
Yeah, you can write an Applescript that will fill in the column on command (it will not update dynamically, and you don't want to be editing one of the cells when you run the script). Put the script in the OmniOutliner scripts folder and the Customize Toolbar command will allow you to put a button for it in your toolbar. I don't recall if the ability to make a document-specific toolbar is a OO Pro feature, but if it isn't, that would be even better.

Here's a sample:
Code:
tell application "OmniOutliner"
	tell front document
		set currentDate to (current date)
		
		if title of every column does not contain {"Date due"} then
			display dialog "You need columns named 'Date due' and 'Days overdue' for this script" buttons "Cancel" default button 1
		end if
		if title of every column does not contain {"Days overdue"} then
			display dialog "You need columns named 'Date due' and 'Days overdue' for this script" buttons "Cancel" default button 1
		end if
		
		repeat with myRow in every row
			if (state of myRow is unchecked) then
				set rowDueDate to value of cell "Date due" of myRow
				if (rowDueDate is not missing value) then
					if (currentDate > rowDueDate) then
						set daysOverdue to (currentDate - rowDueDate) / days
					else
						set daysOverdue to missing value
					end if
					set value of cell "Days overdue" of myRow to daysOverdue
				end if
			end if
			
		end repeat
	end tell
end tell
"Date due" should be a column of type Date, and "Days overdue" should be a column of type Number, and both allow some variation in formatting which you should adjust to suit.
 
Quote:
Originally Posted by New Horizon View Post

Thank you. This is exactly what I'm looking for; however, one problem: I'm new with MACs and weak with Applescript (but strong with Fortran, PERL, and C++), so I'm very willing to learn.
We won't be making any use of the FORTRAN, you can answer any questions I have in the future about the other two and we'll call it even :-)

A personal pet peeve of mine, totally irrational, no argument -- please call it a Mac, not a MAC.

Quote:

I do not have an "OmniOutliner Scripts" folder in "Applications." The OmniOutliner program is the only thing in Applications.
Okay, the tutorial written by RobTrew over in the OF forum will do the right thing if you simply read "OmniOutliner Pro" wherever it says "OmniFocus". However, I'm stuck waiting here, so I'll spell it out for you.

In the top-level Applications folder, there should be a folder called AppleScript, and in it there is the AppleScript Utility application. Launch that, and make sure the "Show Script Menu in menu bar" box is checked. Now launch OmniOutliner Pro, and while OmniOutliner Pro is the foremost application (it should say OmniOutliner Pro in the menu bar at the left), select that AppleScript menu (it will look like a fancy S or perhaps a scroll depending on your imagination) and choose Open Scripts Folder and Open OmniOutliner Pro Folder. This will create the folder in the right place for you, including any other folders needed to create the hierarchy.
Quote:
As I understand, I can create an "OmniOutliner Scripts" folder in the Applications folder. There I put the script you have written and call it anything I want. From there OmniOutliner will know it's there? How to invoke it so the Customize Toolbar knows it is there?
Do as outlined above and you'll have a folder called ~/Library/Scripts/Applications/OmniOutliner Pro where you can deposit scripts intended for use by OmniOutliner Pro, or you can write your own there with the Script Editor (or AppleScript Editor as it is called in Snow Leopard). With the script I provided as text instead of a downloadable script file, you would open up the Script Editor, paste in the text from my post, and save it as "Days past due" (or whatever) in that folder. To add it to your toolbar in OOP, do View->Customize Toolbar... or View->Create Document-specific Toolbar to build a custom toolbar for the current document. Now it's just a matter of dragging icons around to arrange the toolbar you want.

Try it out, give a shout if it still doesn't work...
 
The AppleScript folder under Applications is empty. There is no Applescript Utility on my "Mac." I did a search and found nothing. I'm running the lastest version of Snow Leopard with all updates. I do have a Utilities directory under Applications where there is an AppleScript Editor.
 
... still working on it. Found out things changed in Snow Leopard: http://www.macworld.com/article/1424...gonewhere.html .
 
Whpalmer4,

Thank you. I got it working. In Snow Leopard, AppleScript Editor handles what AppleScript Utility did before. Once past that your instructions got me going and I created a task outline with "Date due" and "Days overdue."

Now I'm off to learn AppleScript.

You are a big help. Thanks again.
 
Glad you got it figured out -- I was on a Leopard-based system at the time and didn't realize the Script Utility had gone away (I've usually built those folders by hand).

For scripts relating to OO in particular, check out the Useful Scripts download in the Extras section of the OO webpage. Easier to see how to do some common manipulations that way than by learning all of AppleScript!
 
Because I'm learning AppleScript (currently novice) I will ask questions. Is it possible to run an AppleScript as a wrapper for an outline that also runs an AppleScript (like the one above) so as to appear (the script above) to run automatically?

In Unix one can create a "here" document/command/script that can supply arguments to and run an application. I'm wondering if something similar can be done with AppleScript, where the wrapper AppleScript runs OmniOutliner supplying the outline to run and which AppleScript in the outline to run too.

Thanks ... .
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weekly Repeating Project with Tasks on Specific Week Days ttorres OmniFocus 1 for Mac 2 2012-09-02 10:36 PM
Past Tasks by Date eamndl OmniFocus 1 for Mac 2 2012-07-05 10:41 AM
Days between two tasks/milestones aboeing OmniPlan General 0 2011-12-08 06:02 PM
Filter to See tasks for 'X' days pakiyabhai OmniFocus 1 for Mac 1 2010-12-16 03:55 PM
Past Due Tasks and Due Status? Greg Jones OmniFocus 1 for Mac 5 2010-05-13 04:51 PM


All times are GMT -8. The time now is 05:34 AM.


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