Plug-In: Style “Syllabus”
(NOTE: This plug-in requires OmniFocus 4.x)
This plug-in will apply a set of style attributes to the note of the selected project or task.
Here are the available attribute settings of this style:
- font-family: Avenir Next
- font-size: 14 (13 on iPhone)
- paragraph-line-spacing: 3.5
- paragraph-alignment: Left
- paragraph-minimum-line-height: 19.5
- paragraph-spacing-before: 8
- underline-color: Color.RGB(0, 0, 0, 1)
- strikethrough-color: Color.RGB(0, 0, 0, 1)
- font-stroke: Color.RGB(1, 1, 1, 1)
- font-fill: Color.RGB(0.15, 0.15, 0.15, 1)
- text-background-color: Color.RGB(1, 1, 1, 0)
Return to: OmniFocus Plug-In Collection
Note Style: Syllabus
/*{"type": "action","targets": ["omnifocus"],"author": "Otto Automator","identifier": "com.omni-automation.of.note-template-syllabus","version": "1.7","description": "This plug-in will format the rich text of the note of the selected project or task. To fully apply all parameters, use the reset plug-ins to reset existing settings to defaults.","label": "Note Style “Syllabus”","shortLabel": "Syllabus Style","paletteLabel": "Syllabus Style","image": "wand.and.stars"}*/(() => {const action = new PlugIn.Action(function(selection, sender){// ACTION CODEvar deviceIsPhone = (Device.current.type === DeviceType.iPhone) ? true:false// SELECTION OPTIONS: TASKS, PROJECTS, FOLDERS, TAGS, ALLOBJECTS, DATABASEOBJECTSvar item = selection.databaseObjects[0]// CREATE VIRTUAL TEXT OBJECT CONTAING CURRENT NOTEvar noteObj = new Text("", baseStyle)noteObj.replace(noteObj.range, item.noteText)var nStyle = noteObj.style// GET ATTRIBUTES RANGESvar runRanges = noteObj.ranges(TextComponent.AttributeRuns)// PROCESS THE ATTRIBUTE RANGESrunRanges.forEach(range => {runStyle = noteObj.styleForRange(range)runStyle.set(Style.Attribute.FontFamily, 'Avenir Next')typeSize = (deviceIsPhone) ? 13:14runStyle.set(Style.Attribute.FontSize, typeSize)runStyle.set(Style.Attribute.FontStrokeColor, Color.RGB(0, 0, 0, 1))runStyle.set(Style.Attribute.FontFillColor, Color.RGB(0.15, 0.15, 0.15, 1))runStyle.set(Style.Attribute.UnderlineColor, Color.RGB(0, 0, 0, 1))runStyle.set(Style.Attribute.StrikethroughColor, Color.RGB(0, 0, 0, 1))runStyle.set(Style.Attribute.ParagraphAlignment, TextAlignment.Left)runStyle.set(Style.Attribute.ParagraphMinimumLineHeight, 19.5)runStyle.set(Style.Attribute.ParagraphSpacingBefore, 8)runStyle.set(Style.Attribute.ParagraphLineSpacing, 3.5)// TURN OFF BACKGROUND COLOR, ALPHA = 0runStyle.set(Style.Attribute.BackgroundColor, Color.RGB(1, 1, 1, 0))})// REPLACE NOTE WITH VIRTUAL OBJECTitem.noteText.replace(item.noteText.range, noteObj)// REVEAL NOTEtree = document.windows[0].contenttree.nodeForObject(item).expandNote(false)});action.validate = function(selection, sender){// validation code// selection options: tasks, projects, folders, tags, databaseObjects, allObjectsreturn (selection.tasks.length === 1 || selection.projects.length === 1 )};return action;})();