×

VCOF0117

OmniFocus: Note Character Settings

A voice command for setting and restoring the character attributes of the note of the selected project or task.

Scope and Syntax

Language: English (United States 🇺🇸 · Great Britain 🇬🇧 · Australia 🇦🇺 · Canada 🇨🇦) • Scope: OmniFocus

Command phrase variations (words in [brackets] are optional):

Requirements

Video: Note Settings
A set of voice commands for controlling the formatting of the note text of the selected project or task.

Downloads

Using the Command

The following is an explanation of how to use the character attribute editing interface.

Character settings dialog

(above) Each of the specified character attributes has its own menu of settings and options. By default, the initial setting for each property is: “No Change”

The property menus offer these two options:

  • No Change • When this option is chosen, no changes will be made to the paragraph attribute.
  • Default • When this option is chosen, the default value for the paragraph attribute will be applied to the note text.

NOTE: Immediately following each attribute title, placed within parens, is the current value of that attribute in the note.

IMPORTANT: Attribute changes are applied to all of the note text, not just a selection.

Here is a description of each of the character attributes:

  • Font Family (String) • The name of the font family to be applied to the note. The cross-platform typeface options are; "Default", "Avenir Next", "Baskerville", "Bodoni 72", "Bradley Hand", "Chalkboard SE", "Cochin", "Courier New", "Damascus", "Georgia", "Gill Sans", "Helvetica Neue", "Hoefler Text", "Menlo", "Noteworthy", "Optima", "Palatino", "Rockwell", "Savoye LET", "Snell Roundhand", "Times New Roman", "Trebuchet MS", and "Verdana"
  • Font Weight (Number) • This value, from 1 through 9, indicates the thickness of the typeface. Light-thin variations are usually 1-2, book or regular variations are usually 3-5, and the higher settings are for bold. Use the System Font Panel (⌘T) to confirm.
  • Font Size (Number) • The size (in points) to be used. Options include: "Default", "9", "10", "11", "12", "13", "14", "15", "16", "18", "24"
  • Kerning Adjustment (Number) • Controls the space between characters. For example, some of the lighter typeface when used at a larger type size, require slight positive (increased) kerning to display well. Options include: "Default", "+3", "+2", "+1", " 0", "-1", "-2", and "-3"
  • Color Shade (Percent) • Whe used, this setting will cause the note text to display as a shade of black (or white for Dark Mode). Options are (%): "Default", "100", "95", "90", "85", "80", "75", "70"
Character Settings


(async () => { try { function createUtterance(textToSpeak){ AlexID = ( (app.platformName === "macOS") ? "com.apple.speech.synthesis.voice.Alex" : "com.apple.speech.voice.Alex" ) voiceObj = Speech.Voice.withIdentifier(AlexID) voiceRate = 0.4 utterance = new Speech.Utterance(textToSpeak) utterance.voice = voiceObj utterance.rate = voiceRate return utterance } var synthesizer = new Speech.Synthesizer() var sel = document.windows[0].selection if(sel.tasks.length === 1 || sel.projects.length === 1 ){ var item = sel.databaseObjects[0] } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } if(item.note.length === 0){ throw { name: "Selection Issue", message: "The note of the selected item, contains no text." } } // CREATE VIRTUAL TEXT OBJECT CONTAING CURRENT NOTE var noteObj = new Text("", baseStyle) noteObj.replace(noteObj.range, item.noteText) var nStyle = noteObj.style // GET ATTRIBUTES RANGES var runRanges = noteObj.ranges(TextComponent.AttributeRuns) // CREATE FORM AND FORM ELEMENTS fontFamilyTitles = ["Default", "Avenir Next", "Baskerville", "Bodoni 72", "Bradley Hand", "Chalkboard SE", "Cochin", "Courier New", "Damascus", "Georgia", "Gill Sans", "Helvetica Neue", "Hoefler Text", "Menlo", "Noteworthy", "Optima", "Palatino", "Rockwell", "Savoye LET", "Snell Roundhand", "Times New Roman", "Trebuchet MS", "Verdana"] fontFamilyIndexes = fontFamilyTitles.map((title, index) => index) var fontFamCurVal = nStyle.get(Style.Attribute.FontFamily) fontFamCurVal = (fontFamCurVal === ".AppleSystemUIFont") ? "System Font":fontFamCurVal fontFamilyMenu = new Form.Field.Option( "fontFamily", `Font Family (${fontFamCurVal})`, fontFamilyIndexes, fontFamilyTitles, null ) fontFamilyMenu.allowsNull = true fontFamilyMenu.nullOptionTitle = "No Change" fntWghtCurVal = nStyle.get(Style.Attribute.FontWeight) fntWghtValueStrings = ["Default", "1", "2", "3", "4", "5", "6", "7", "8", "9"] fntWghtValues = fntWghtValueStrings.map((title, index) => index) fontWeightMenu = new Form.Field.Option( "fontWeight", `Font Weight (${fntWghtCurVal})`, fntWghtValues, fntWghtValueStrings, null ) fontWeightMenu.allowsNull = true fontWeightMenu.nullOptionTitle = "No Change" var fntSzeCurVal = nStyle.get(Style.Attribute.FontSize) fntSzeValueStrings = ["Default", "9", "10", "11", "12", "13", "14", "15", "16", "18", "24"] fntSzeValues = fntSzeValueStrings.map((title, index) => index) fontSizeMenu = new Form.Field.Option( "fontSize", `Font Size (${fntSzeCurVal})`, fntSzeValues, fntSzeValueStrings, null ) fontSizeMenu.allowsNull = true fontSizeMenu.nullOptionTitle = "No Change" fntKrnCurVal = nStyle.get(Style.Attribute.KerningAdjustment) fntKrnCurVal = fntKrnCurVal.toString() fntKrnCurVal = (fntKrnCurVal === "NaN") ? "0":fntKrnCurVal fntKrnValueStrings = ["Default", "+3", "+2", "+1", " 0", "-1", "-2", "-3"] fntKrnValues = fntKrnValueStrings.map((title, index) => index) fontKerningMenu = new Form.Field.Option( "kerningAdjustment", `Kerning Adjustment (${fntKrnCurVal})`, fntKrnValues, fntKrnValueStrings, null ) fontKerningMenu.allowsNull = true fontKerningMenu.nullOptionTitle = "No Change" fntFilClrCurVal = nStyle.get(Style.Attribute.FontFillColor) fntFilClrCurVal = String(100 - (fntFilClrCurVal.white * 100)) fntFilClrValStrings = ["Default", "100", "95", "90", "85", "80", "75", "70"] fntFilClrIndexes = fntFilClrValStrings.map((title, index) => index) fontFillColorMenu = new Form.Field.Option( "fontFillColor", `Color Shade Pct (${fntFilClrCurVal})`, fntFilClrIndexes, fntFilClrValStrings, null ) fontFillColorMenu.allowsNull = true fontFillColorMenu.nullOptionTitle = "No Change" // CONSTRUCT FORM inputForm = new Form() inputForm.addField(fontFamilyMenu) inputForm.addField(fontWeightMenu) inputForm.addField(fontSizeMenu) inputForm.addField(fontKerningMenu) inputForm.addField(fontFillColorMenu) utterance = createUtterance("Character Settings") synthesizer.speakUtterance(utterance) formPrompt = "Character Settings:" buttonTitle = "Continue" formObject = await inputForm.show(formPrompt, buttonTitle) // retrieve attribute settings fontFamilyIndex = formObject.values["fontFamily"] fontFamily = fontFamilyTitles[fontFamilyIndex] fontWeightIndex = formObject.values["fontWeight"] fontWeight = fntWghtValueStrings[fontWeightIndex] fontSizeIndex = formObject.values["fontSize"] fontSize = fntSzeValueStrings[fontSizeIndex] fontKerningIndex = formObject.values["kerningAdjustment"] fontKerning = fntKrnValueStrings[fontKerningIndex] fontFillColorIndex = formObject.values["fontFillColor"] fontFillColor = fntFilClrValStrings[fontFillColorIndex] // SET ATTRIBUTE VALUES var attsToModify = [] var valuesToApply = [] var changeCount = 0 if(fontFamily){ if(fontFamily === "Default"){ var valueToSet = Style.Attribute.FontFamily.defaultValue } else { var valueToSet = fontFamily } attsToModify.push(Style.Attribute.FontFamily) valuesToApply.push(valueToSet) changeCount += 1 } if(fontWeight){ if(fontWeight === "Default"){ var valueToSet = Style.Attribute.FontWeight.defaultValue } else { var valueToSet = parseInt(fontWeight) } attsToModify.push(Style.Attribute.FontWeight) valuesToApply.push(valueToSet) changeCount += 1 } if(fontSize){ if(fontSize === "Default"){ var valueToSet = Style.Attribute.FontSize.defaultValue } else { var valueToSet = parseInt(fontSize) } attsToModify.push(Style.Attribute.FontSize) valuesToApply.push(valueToSet) changeCount += 1 } if(fontKerning){ if(fontKerning === "Default"){ var valueToSet = Style.Attribute.KerningAdjustment.defaultValue } else { var valueToSet = parseInt(fontKerning) } attsToModify.push(Style.Attribute.KerningAdjustment) valuesToApply.push(valueToSet) changeCount += 1 } if(fontFillColor){ if(fontFillColor === "Default"){ var valueToSet = Style.Attribute.FontFillColor.defaultValue } else { var shadePct = parseInt(fontFillColor) shadePct = shadePct * 0.01 shadeValue = 1 - shadePct valueToSet = Color.White(shadeValue, 1) } attsToModify.push(Style.Attribute.FontFillColor) valuesToApply.push(valueToSet) attsToModify.push(Style.Attribute.FontStrokeColor) valuesToApply.push(valueToSet) changeCount += 1 } // APPLY THE SPECIFIED ATTRIBUTE SETTINGS runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) attsToModify.forEach((att, index) => { valueToSet = valuesToApply[index] runStyle.set(att, valueToSet) }) }) // REPLACE NOTE WITH VIRTUAL OBJECT if(changeCount !== 0){ item.noteText.replace(item.noteText.range, noteObj) } // REVEAL NOTE tree = document.windows[0].content tree.nodeForObject(item).expandNote(false) changeCount = (changeCount === 0) ? "No":String(changeCount) editOrEdits = (changeCount === 1) ? "edit":"edits" utterance = createUtterance(`${changeCount} ${editOrEdits} applied!`) synthesizer.speakUtterance(utterance) } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();

 

 

 

LEGAL

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. OMNI-AUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. OMNI-AUTOMATION.COM provides this only as a convenience to our users. OMNI-AUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and OMNI-AUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from OMNI-AUTOMATION.COM and that OMNI-AUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.