AppleScript commands to clear style in OO3 Pro

Timothy J.Wood tjw at omnigroup.com
Thu Dec 16 13:43:20 PST 2004



   Sorry for the late reply ... been busy fixing bugs :)


On Dec 12, 2004, at 4:43 PM, Curtis Clifton wrote:

> I'm experimenting with AppleScripting in OO3 Pro.  The improved 
> scripting interface seems very nice.  I've figured out how to apply a 
> named style to a row:
> 	set style of selected rows to named style "Active"


   That doesn't work for me (nor would I expect it to do anything other 
than possibly copy the current attributes of the named style to the 
row's style).

   What you probably want is:

		repeat with MyRow in selected rows
			add named style "Active" to named styles of style of MyRow
		end repeat

   (I can't seem to figure out a way to do this w/o the repeat, sadly)


> but I haven't figured out how to do the equivalent of a "Clear Style".


	Assume you have a style reference, MyStyle:

	-- Remove any locally inherited named styles
	remove named styles of MyStyle from named styles of MyStyle

	-- Remove any locally set the style attribute values
	set value of every attribute of MyStyle to missing value


   NOTE!  This last bit is different from setting the attributes to 
their 'factory defaults', which you could accomplish with:

	repeat with MyAttribute in (attributes of MyStyle)
		set value of MyAttribute to default value of MyAttribute
	end repeat

   the first case will leave level styles in effect while the second 
case will set the style to the factory default style, regardless of the 
level styles.

   There is more work that could be done in the script support for style 
attributes; some of that we already have logged for 3.1, but if you 
find something missing, please send us a feature request at 
omnioutliner3 at omnigroup.com


> Also, even with a named style applied to the selected row, the 
> following returns an empty list:
> 	return named style of style of item 1 of selected rows

   This is probably the automatic level style generation.  If you turn 
on the style display mode, you'll probably see that the style has moved 
up into the parent of the selected row.  We know that this design has 
both its fans and enemies, so you can turn this off in the Format menu. 
  We would appreciate feedback on this issue too, naturally.

-tim




More information about the OmniOutliner-Users mailing list