×

VCOF0115

OmniFocus: Reset Formatting Commands

Commands for setting the values of the specified project or task note style attributes to their default values.

Scope and Syntax

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

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

*NOTE: The “Tab Stops” and “Tab Interval” properties are not included in the “Paragraph Properties” set of attributes and instead have their own command.

Requirements

(OmniFocus 4 TestFlight only)

Downloads

Script Code

Here is the script code for the commands:

 

IMPORTANT: The following resets all style attributes, including: link, font-weight, font-italic, baseline-offset, and baseline-superscript.

Reset All Note Formatting


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText nStyle = noteObj.style localAtts = nStyle.locallyDefinedAttributes attKeys = localAtts.map(att => att.key) attKeys.forEach(thisKey => { var targetAtt = localAtts.find(att => { return att.key === thisKey }) try { nStyle.set(targetAtt, targetAtt.defaultValue) } catch(err){console.error(targetAtt.key, err.message)} }) utterance = createUtterance("Attributes reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 

IMPORTANT: The following reset leaves the attributes: link, font-weight, font-italic, baseline-offset, and baseline-superscript, untouched.

Reset Note Formatting


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) localAtts = runStyle.locallyDefinedAttributes attKeys = localAtts.map(att => att.key) exclusionKeys = ["link", "font-weight", "font-italic", "baseline-offset", "baseline-superscript"] attKeys.forEach(thisKey => { if(!exclusionKeys.includes(thisKey)){ var targetAtt = localAtts.find(att => { return att.key === thisKey }) try { runStyle.set(targetAtt, targetAtt.defaultValue) } catch(err){console.error(targetAtt.key, err.message)} } }) }) utterance = createUtterance("Note style reset.") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Size


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set(Style.Attribute.FontSize, Style.Attribute.FontSize.defaultValue) }) utterance = createUtterance("Size reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Weight


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set(Style.Attribute.FontWeight, Style.Attribute.FontWeight.defaultValue) }) utterance = createUtterance("Weight reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Color


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set( Style.Attribute.FontStrokeColor, Style.Attribute.FontStrokeColor.defaultValue ) runStyle.set( Style.Attribute.FontFillColor, Style.Attribute.FontFillColor.defaultValue ) runStyle.set( Style.Attribute.UnderlineColor, Style.Attribute.UnderlineColor.defaultValue ) runStyle.set( Style.Attribute.StrikethroughColor, Style.Attribute.StrikethroughColor.defaultValue ) }) utterance = createUtterance("Color reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Italics


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set(Style.Attribute.FontItalic, Style.Attribute.FontItalic.defaultValue) }) utterance = createUtterance("Italics reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Font Family


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set(Style.Attribute.FontFamily, Style.Attribute.FontFamily.defaultValue) }) utterance = createUtterance("Font family reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Paragraph Properties


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) // formatting var pAtts = [ Style.Attribute.ParagraphBaseWritingDirection, Style.Attribute.ParagraphAlignment, Style.Attribute.ParagraphFirstLineHeadIndent, Style.Attribute.ParagraphHeadIndent, Style.Attribute.ParagraphLineHeightMultiple, Style.Attribute.ParagraphLineSpacing, Style.Attribute.ParagraphMaximumLineHeight, Style.Attribute.ParagraphMinimumLineHeight, Style.Attribute.ParagraphSpacing, Style.Attribute.ParagraphSpacingBefore, Style.Attribute.ParagraphTailIndent ] // identify objects noteObj = DBItem.noteText var runRanges = noteObj.ranges(TextComponent.AttributeRuns) // process attribute runs runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) pAtts.forEach(att => { runStyle.set(att, att.defaultValue) }) }) utterance = createUtterance("Paragraphs reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Tabs


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set(Style.Attribute.ParagraphTabStops, Style.Attribute.ParagraphTabStops.defaultValue) runStyle.set(Style.Attribute.ParagraphDefaultTabInterval, Style.Attribute.ParagraphDefaultTabInterval.defaultValue) }) utterance = createUtterance("Tabs reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Note Font Properties


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] // reveal note tree = document.windows[0].content tree.nodeForObject(DBItem).expandNote(false) // formatting var fAtts = [ Style.Attribute.FontCondensed, Style.Attribute.FontFamily, Style.Attribute.FontFillColor, Style.Attribute.FontFixedPitch, Style.Attribute.FontItalic, Style.Attribute.FontName, Style.Attribute.FontNarrow, Style.Attribute.FontSize, Style.Attribute.FontStrokeColor, Style.Attribute.FontStrokeWidth, Style.Attribute.FontWeight, Style.Attribute.KerningAdjustment, Style.Attribute.Obliqueness, Style.Attribute.BaselineOffset, Style.Attribute.BaselineSuperscript, Style.Attribute.Expansion ] // identify objects noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) // process attribute runs runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) fAtts.forEach(att => { runStyle.set(att, att.defaultValue) }) }) utterance = createUtterance("Font properties reset!") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } catch(err){ if(!err.causedByUserCancelling){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } } })();
 
Reset Background


(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() sel = document.windows[0].selection items = sel.databaseObjects.filter( item => (item instanceof Project || item instanceof Task) ) if(items.length === 1){ DBItem = items[0] noteObj = DBItem.noteText runRanges = noteObj.ranges(TextComponent.AttributeRuns) runRanges.forEach(range => { runStyle = noteObj.styleForRange(range) runStyle.set(Style.Attribute.BackgroundColor, Color.RGB(1, 1, 1, 0)) }) utterance = createUtterance("Background reset") synthesizer.speakUtterance(utterance) } else { throw { name: "Selection Issue", message: "Please select a single project or task." } } } 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.