OO-PG0011
Plug-In: Grid Lines
This plug-in displays a form for controlling the display and color of the outline’s vertical and horizontal grid lines.
Return to: OmniOutliner Plug-In Collection
Grid Lines
/*{"type": "action","targets": ["omnioutliner"],"author": "Otto Automator","identifier": "com.omni-automation.oo.grid-lines","version": "1.0","description": "Control the display and color of the outline’s vertical and horizontal grid lines.","label": "Grid Lines","shortLabel": "Grid Lines","paletteLabel": "Grid Lines","image": "grid"}*/(() => {const action = new PlugIn.Action(async function(selection, sender){// action code// selection options: columns, document, editor, items, nodes, outline, stylestry {var lineColorOptions = ["None", "Black", "Gray", "White", "Red", "Green", "Blue"]var lineColorValues = [null, Color.black, Color.gray, Color.white, Color.red, Color.green, Color.blue]verticalLinesMenu = new Form.Field.Option("verticalLines","Vertical",[0, 1, 2, 3, 4, 5, 6],lineColorOptions,0)horizontalLinesMenu = new Form.Field.Option("horizontalLines","Horizontal",[0, 1, 2, 3, 4, 5, 6],lineColorOptions,0)// CREATE NEW FORM AND ADD FIELDinputForm = new Form()inputForm.addField(verticalLinesMenu)inputForm.addField(horizontalLinesMenu)// VALIDATE USER INPUTinputForm.validate = function(formObject){return true}// DISPLAY THE FORMformPrompt = "Select grid line options:"buttonTitle = "Continue"formObject = await inputForm.show(formPrompt, buttonTitle)// RETRIVE FORM INPUTverticalIndex = formObject.values["verticalLines"]horizontalIndex = formObject.values["horizontalLines"]verticalGridColor = lineColorValues[verticalIndex]horizontalGridColor = lineColorValues[horizontalIndex]}catch(err){if(!err.causedByUserCancelling){new Alert(err.name, err.message).show()}}});action.validate = function(selection, sender){// validation code// selection options: columns, document, editor, items, nodes, outline, stylesreturn true};return action;})();