Applescript action for "completed" items

Curtis Clifton curt.clifton at mac.com
Mon Jan 9 11:55:37 PST 2006


On Jan 9, 2006, at 11:24 AM, Brian Campbell wrote:

> I'm new to OmniOutliner, this list and pretty much clueless about  
> AppleScript.  However, i'm wondering... Is it possible to create a  
> script that applies a style (say changing the color of a row and  
> it's children) once the checkbox for that row has been selected?

property completedStrikethroughColor : {39321, 39321, 39321}
property completedStrikethroughStyle : "single"

tell front document of application "OmniOutliner Professional"
	-- Clears style attributes that I'm using to track completion
	set notDoneRows to a reference to (every row whose state is not  
checked)
	set value of attribute "font-fill" of style of notDoneRows to  
missing value
	set value of attribute "strikethrough-style" of style of notDoneRows  
to missing value
	-- Set style attributes that I'm using to track completion
	set doneRows to a reference to (every row whose state is checked)
	set value of attribute "font-fill" of style of doneRows to  
completedStrikethroughColor
	set value of attribute "strikethrough-style" of style of doneRows to  
completedStrikethroughStyle
end tell


> An alternative that I'd even prefer is to create a dropdown list,  
> and apply different styles to a row based on the selection from  
> that list...

That's slightly more complex, mostly because you need to set up some  
sort of mapping that says for a give selection in the list and given  
highlight should apply.  Here's one example for modification:

-- a list of pairs for coloring rows
property colorMap : {{val:"One", col:{65535, 40000, 40000}},  
{val:"Two", col:{65535, 30000, 30000}}, {val:"Three", col:{65535,  
20000, 20000}}}
property attributeToUse : "text-background-color"
property columnOfInterest : "Priority"

tell front document of application "OmniOutliner Professional"
	-- Clears style attributes that I'm using to track completion
	set allRows to a reference to (every row)
	set value of attribute attributeToUse of style of allRows to missing  
value
	repeat with aValueColorPair in colorMap
		set interestingRows to (a reference to (every row whose value of  
cell columnOfInterest is (val of aValueColorPair)))
		set value of attribute attributeToUse of style of interestingRows  
to (col of aValueColorPair)
	end repeat
end tell

Hope that helps!

Cheers,

Curt

----------------------------------
Curt Clifton, Asst. Professor
Computer Science and Software Engineering
Rose-Hulman Institute of Technology
812.877.8593
http://www.rose-hulman.edu/~clifton




More information about the OmniOutliner-Users mailing list