Painless Software Schedules and OO

Ben Bornstein ben.bornstein at jpl.nasa.gov
Mon Mar 15 14:19:15 PST 2004


Hi James,

      How funny.  I'm working on the same thing.  I posted to this list 
a few weeks ago with an Applescript resource vs. data-fork problem (I'm 
an Applescript newbie).

      I've included my script below (and copied the list in case anyone 
else is interested and to report a possible OO bug).  To be honest, 
once I wrote it, I got busy with other things, so I haven't really had 
a chance to try it out much. :)

      The main problem (bug in OO?) I've encountered is that parent 
column summaries do not recalculate when I "set value of cell [index] 
of [row reference] to ...".

      I'll study your script later this evening. :)


Ben


On Mar 15, 2004, at 1:50 PM, James Lorenzen wrote:

Subject: Re: Applescript "NSCannotCreateScritpCommandError" OO 2.2.6 
and MacOS 10.3.2

> The script is an attempt to provide some horizontal calculations in a 
> simple outline based on Joel Spolsky and "Painless Software 
> Schedules".  <www.joelonsoftware.com>


tell application "OmniOutliner"
	
	tell front document
		---
		--- Get references to columns based on titles.
		---
		repeat with c from 1 to count of columns
			set t to title of column c as string
			
			if t contains "Curr" then
				set currId to c
			else if t contains "Elapsed" then
				set elapsedId to c
			else if t contains "Remain" then
				set remainId to c
			else if t contains "Done" then
				set doneId to c
			end if
		end repeat
		
		---
		--- For each row, compute current and elapsed
		---	
		repeat with thisRow in (every row where has subtopics is false)
			set current to 0
			set elapsed to 0
			
			repeat with c from 1 to count of cells in thisRow
				set thisCell to cell c of thisRow
				
				if text of thisCell is not "" then
					if c is currId then
						set current to value of thisCell
					else if c is elapsedId then
						set elapsed to value of thisCell
					end if
				end if
			end repeat
			
			if current is not 0 then
				set remaining to (current - elapsed)
				set value of cell remainId of thisRow to remaining
				
				if remaining is 0 then
					set done to 2
				else if elapsed is not 0 then
					set done to 1
				else
					set done to 0
				end if
				
				set value of cell doneId of thisRow to done
			end if
			
		end repeat
	end tell
	
end tell




More information about the OmniOutliner-Users mailing list