Dynamic Named Styles based on text or saved filter?


At first I was puzzled about where/how to install but what worked for me here was to simply double-click the download (after double-clicking the zip). This installed Apply Keyword Styles.omnioutlinerjs in the the bowels of the Library at: Library > Containers > com.omnigroup.OmniOutliner5 > Data > Library > Application Support > PlugIns. Apply Keyword Styles then showed up in my Scripts menu (per the screenshot above).

I understand we need to wait until 5.0.5 build 288342 (or higher) for this to work.


1 Like

Just thought I’d note that r288342 is now available on our public test page:


1 Like

Thanks for sharing useful information …

Thanks to @kcase and @tjw for this working example to help get us started. It requires the user to trigger the script by choosing Apply Keyword Styles from the menu, but is a great start.


I’ve had a certain amount of luck using the Timer to automate tasks…
This one will find all rows that have a checked status and set the Date Completed column.
Once it’s instantiated, it will constantly check the document without having to re-run the “Action”

var _ = (function(){
	var timer = Timer.repeating(1, function(timer) {
			var col = document.outline.columns.byTitle('Date Completed');
			var items = document.outline.rootItem.descendants;
			for(i in items) {
				var item = items[i];
				if (item.topic === 'xyzzy') {
				var state = item.state;
				var date = item.valueForColumn(col);
				if (state === State.Unchecked && date) {
					console.log(item.topic + " Date unset");
					item.setValueForColumn(null, col);
				} else if (state == State.Checked && !date) {
					console.log(item.topic + " Date SET");
					item.setValueForColumn(new Date(), col);
	timer.count = 0;
	var action = new PlugIn.Action(function(selection, sender) {
		var alert = new Alert("Greg's Automation", "Automation started...");

	action.validate = function(selection, sender){
		return true;
	return action;

// COPY & PASTE into editor app. EDIT & SAVE with “.omnijs” file extension.
	"type": "action",
	"targets": ["omnioutliner"],
	"author": "Greg Smith",
	"description": "Sets the Done Date when the item is selected.",
	"label": "Greg's Automation",
	"paletteLabel": "Greg's Automation"

@Sal @kcase @draft8 Was Handler ever implemented as described here, such that it would notice when a row changes and automatically update it. Would like to use it for conditional highlighting, e.g. a row contains a certain word in then turn it a certain color.

@SGIII, this is a first attempt at this issue.


To attach the handler to the current Outline, type (in the Console):

const redHandler = PlugIn.find("com.unlocked2412.conditionalFormatting").handler('redHighlighting')

To detach the handler, type (again, in the console):




THANKS for this!

I downloaded and dragged the unzipped package into my OmniPlug-Ins folder on iCloud Drive.

Then I typed into the Console, getting this:

Also tried this, predictably getting:

How does one troubleshoot from here?

You’re welcome, @SGIII.

Not getting that error, here.

In any case, updated the PlugIn in this new link:

Does it work, now ?

Did you link another iCloud folder ? Are you using the default one provided by OO ?

@SGIII, I missed one step. These are the correct steps, I think.

To attach the handler to the current Outline, we should call onCellChanged method with the handler as the parameter and store it in a variable.

I would type (in the Console):

const redHandler = PlugIn.find("com.unlocked2412.conditionalFormatting").handler('redHighlighting')

Attaching the handler and returning a PlugIn.Handler.Registration

const registration = onCellChanged(redHandler)

To detach the handler, I would type (again, in the console):



I can’t remember whether I’m using the default iCloud folder (mine is OmniPlug-Ins at the top level) but in any case it works now!

My goal is to apply colors to rows depending on values contained in the text of a target column, say the Cat column (which may have longer text than shown here, multiple words).

Will study this more later. Thanks so much!

1 Like

Hi Gabriel, could you share this file again?
Thanks and sorry for the trouble.

Hi, @Bernard-o. Sure. Per your request, I’ve just uploaded it to my repository.

1 Like

Thank you for the swift reply :)

Do you, or any of the others, notice the app slowing down when this is active? I just tested (it works!) but I notice a bit of lag in the text showing up in the screen as I type (probably because the app is checking for the string).

(On a M1 MBP)

@Bernard-o, I do not notice lag. See:

Thanks for the feedback. I unlinked a folder with other scripts/plugins and it improved after that. I had already had this problem in the past, when having a few plugins could cause the app to slowdown.

You might try checking the validation functions in those plug-ins to figure out where the issue is. I have quite a few plug-ins installed without any noticeable slowness, but all it takes is one slow validation function to slow down every interaction: plug-in actions appear in menus (and sometimes other places like toolbars), and menu validation happens with every input event. (I recommend limiting any validation to work that can be done in a small amount of constant time. Or just doing any needed validation when your action is actually getting called, rather than preemptively doing it within the plug-in’s validation function.)

1 Like

Thanks for the valuable input Ken. Could you please show dummy Plug-In code exemplifying those two suggestions ?

1 Like