View Single Post
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.