VCOO0047

OmniOutliner Recitation Commands

A collection of commands for having the computer read aloud outline items.

Scope and Syntax

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

Scope: OmniOutliner

NOTE: The recitation commands are not designed to work with outline columns.

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

* Holding down the Option key prior to the command will trigger the recitation of each row’s positional identifier, ex: 2.1.3

* Holding down the Option key prior to the command will prevent the recitation of each row’s positional identifier, ex: 2.1.3

* Holding down the Shift key prior to the command will prevent the recitation of each row’s note.

* Holding down the Shift and Option keys prior to the command will prevent the recitation of each row’s positional identifier and note.

IMPORTANT: For those using an iPhone or iPad without a keyboard, install and use the Read Outline Rows plug-in, which provides an interface for indicating recitation options.

Requirements

NOTE: By default, the plug-in uses the built-in “Alex” voice on macOS, iOS, and iPadOS. Make sure this voice is installed and activated on the devices hosting these Voice Control commands.

On iPadOS/iOS: Settings > Accessibility > Spoken Content > Voices > English > Alex

On macOS: System Settings > Accessibility > Spoken Content > System Voice > Manage Voices… (Customize)

Downloads

Script Code

Here is the voice command Omni Automation code.

Read [This] Row


(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.5 utterance = new Speech.Utterance(textToSpeak) utterance.voice = voiceObj utterance.rate = voiceRate return utterance } function genPositionID(item){ nums = item.ancestors.map(x => 1 + x.index) nums.reverse().push(item.index + 1) return nums.join(".") } try {document.name} catch(err){ throw { name:"Missing Resource", message:"No outline document is open." } } if(app.optionKeyDown){ var shouldIncludeRowID = true } else { var shouldIncludeRowID = false } var synthesizer = new Speech.Synthesizer() editor = document.editors[0] selectedItems = editor.selection.items if(selectedItems.length === 1){ selectedItem = selectedItems[0] rowID = genPositionID(selectedItem) spokenID = rowID.replaceAll(".", " point ") if(shouldIncludeRowID){ utterance = createUtterance(`Row ${spokenID}`) utterance.postUtteranceDelay = 0.5 utterances = [utterance] } else { utterances = [] } textToSpeak = selectedItem.topic if(textToSpeak.length === 0){ textToSpeak = "This row contains no text." } utterance = createUtterance(textToSpeak) utterances.push(utterance) utterances.forEach(utterance => { synthesizer.speakUtterance(utterance) }) alertTitle = `Row ${rowID}` alert = new Alert(alertTitle, "Press “Return” key to stop recitation.") alert.addOption("Stop Speaking") await alert.show() synthesizer.stopSpeaking(Speech.Boundary.Word) } else { throw { name: "Selection Issue", message: "Please select a single row." } } } catch(err){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } })();
Read [This] Note


(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 } function genPositionID(item){ nums = item.ancestors.map(x => 1 + x.index) nums.reverse().push(item.index + 1) return nums.join(".") } try {document.name} catch(err){ throw { name:"Missing Resource", message:"No outline document is open." } } if(app.optionKeyDown){ var shouldIncludeRowID = true } else { var shouldIncludeRowID = false } var synthesizer = new Speech.Synthesizer() editor = document.editors[0] selectedItems = editor.selection.items if(selectedItems.length === 1){ selectedItem = selectedItems[0] rowID = genPositionID(selectedItem) spokenID = rowID.replaceAll(".", " point ") if(shouldIncludeRowID){ utterance = createUtterance(`Note for row ${spokenID}`) utterance.postUtteranceDelay = 0.5 utterances = [utterance] } else { utterances = [] } textToSpeak = selectedItem.note editor.nodeForObject(selectedItem).expandNote() if(textToSpeak.length === 0){ textToSpeak = "This row’s note contains no text." } utterance = createUtterance(textToSpeak) utterances.push(utterance) utterances.forEach(utterance => { synthesizer.speakUtterance(utterance) }) alertTitle = `Note of Row ${rowID}` alertMessage = "Press “Return” to stop recitation." alert = new Alert(alertTitle, "Press “Return” key to stop recitation.") alert.addOption("Stop Speaking") await alert.show() synthesizer.stopSpeaking(Speech.Boundary.Word) } else { throw { name: "Selection Issue", message: "Please select a single row." } } } catch(err){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } })();
Read [This] Row and Note


(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 } function genPositionID(item){ nums = item.ancestors.map(x => 1 + x.index) nums.reverse().push(item.index + 1) return nums.join(".") } try {document.name} catch(err){ throw { name:"Missing Resource", message:"No outline document is open." } } if(app.optionKeyDown){ var shouldIncludeRowID = true } else { var shouldIncludeRowID = false } var synthesizer = new Speech.Synthesizer() editor = document.editors[0] selectedItems = editor.selection.items if(selectedItems.length === 1){ selectedItem = selectedItems[0] rowID = genPositionID(selectedItem) spokenID = rowID.replaceAll(".", " point ") if(shouldIncludeRowID){ utterance = createUtterance(`Row ${spokenID}`) utterance.postUtteranceDelay = 0.5 utterances = [utterance] } else { utterances = [] } textToSpeak = selectedItem.topic if(textToSpeak.length === 0){ textToSpeak = "This row contains no text." } utterance = createUtterance(textToSpeak) utterance.postUtteranceDelay = 0.5 utterances.push(utterance) noteToSpeak = selectedItem.note if(!noteToSpeak){ utterance = createUtterance("This row’s note contains no text.") utterances.push(utterance) } else { utterance = createUtterance("Note for row:") utterance.postUtteranceDelay = 0.5 utterances.push(utterance) utterance = createUtterance(noteToSpeak) utterances.push(utterance) utterance.postUtteranceDelay = 0.5 } utterances.forEach(utterance => { synthesizer.speakUtterance(utterance) }) utterance = createUtterance("Done!") synthesizer.speakUtterance(utterance) alertTitle = `Row ${rowID} and Note` alert = new Alert(alertTitle, "Press “Return” key to stop recitation.") alert.addOption("Stop Speaking") await alert.show() synthesizer.stopSpeaking(Speech.Boundary.Word) } else { throw { name: "Selection Issue", message: "Please select a single row." } } } catch(err){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } })();
Read [This] Outline


(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 } function genPositionID(item){ nums = item.ancestors.map(x => 1 + x.index) nums.reverse().push(item.index + 1) return nums.join(".") } try {document.name} catch(err){ throw { name:"Missing Resource", message:"No outline document is open." } } var shouldIdentifyRow = (app.optionKeyDown) ? false:true var shouldReadNotes = (app.shiftKeyDown) ? false:true var synthesizer = new Speech.Synthesizer() var itemsToRead = rootItem.descendants rowCount = itemsToRead.length rowOrRows = (rowCount === 1) ? "row":"rows" itemOrItems = (rowCount === 1) ? "item":"items" noteOrNotes = (rowCount === 1) ? "note":"notes" var textSegments = new Array() itemsToRead.forEach(item => { if(shouldIdentifyRow){ itemID = genPositionID(item) spokenID = itemID.replaceAll('.', ' point ') identifyingPhrase = `Row ${spokenID}` textSegments.push(identifyingPhrase) } rowText = item.topic if(rowText.length === 0){rowText = "Empty row."} textSegments.push(rowText) if(shouldReadNotes){ noteText = item.note if(noteText.length > 0){ textSegments.push("Note for row.") textSegments.push(noteText) } } }) addedPhrase = (shouldReadNotes) ? `and ${noteOrNotes}`: "" openingUtterance = createUtterance(`Reading ${rowCount} ${itemOrItems} ${addedPhrase}`) openingUtterance.postUtteranceDelay = 0.75 var utterances = [openingUtterance] textSegments.forEach(segment => { console.log(segment) utterance = createUtterance(segment) utterance.postUtteranceDelay = 0.5 utterances.push(utterance) }) utterances.forEach(utterance => { synthesizer.speakUtterance(utterance) }) utterance = createUtterance("Done!") synthesizer.speakUtterance(utterance) alertTitle = (shouldReadNotes) ? "Reading Outline Rows & Notes":"Reading Outline Rows" alert = new Alert(alertTitle, "Press “Return” key to stop recitation.") alert.addOption("Stop Speaking") await alert.show() synthesizer.stopSpeaking(Speech.Boundary.Word) } catch(err){ utterance = createUtterance(err.message) synthesizer.speakUtterance(utterance) //new Alert(err.name, err.message).show() } })();
Read [These] Rows


(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 } function genPositionID(item){ nums = item.ancestors.map(x => 1 + x.index) nums.reverse().push(item.index + 1) return nums.join(".") } try {document.name} catch(err){ throw { name:"Missing Resource", message:"No outline document is open." } } var shouldIdentifyRow = (app.optionKeyDown) ? false:true var shouldReadNotes = (app.shiftKeyDown) ? false:true var synthesizer = new Speech.Synthesizer() var itemsToRead = document.editors[0].selection.items if(itemsToRead.length === 0){ throw { name: "Selection Issue", message: "Please select one or more rows." } } rowCount = itemsToRead.length rowOrRows = (rowCount === 1) ? "row":"rows" itemOrItems = (rowCount === 1) ? "item":"items" noteOrNotes = (rowCount === 1) ? "note":"notes" var textSegments = new Array() itemsToRead.forEach(item => { if(shouldIdentifyRow){ itemID = genPositionID(item) spokenID = itemID.replaceAll('.', ' point ') identifyingPhrase = `Row ${spokenID}` textSegments.push(identifyingPhrase) } rowText = item.topic if(rowText.length === 0){rowText = "Empty row."} textSegments.push(rowText) if(shouldReadNotes){ noteText = item.note if(noteText.length > 0){ textSegments.push("Note for row.") textSegments.push(noteText) } } }) addedPhrase = (shouldReadNotes) ? `and ${noteOrNotes}`: "" openingUtterance = createUtterance(`Reading ${rowCount} ${itemOrItems} ${addedPhrase}`) openingUtterance.postUtteranceDelay = 0.75 var utterances = [openingUtterance] textSegments.forEach(segment => { console.log(segment) utterance = createUtterance(segment) utterance.postUtteranceDelay = 0.5 utterances.push(utterance) }) utterances.forEach(utterance => { synthesizer.speakUtterance(utterance) }) utterance = createUtterance("Done!") synthesizer.speakUtterance(utterance) alertTitle = (shouldReadNotes) ? "Reading Outline Rows & Notes":"Reading Outline Rows" alert = new Alert(alertTitle, "Press “Return” key to stop recitation.") alert.addOption("Stop Speaking") await alert.show() synthesizer.stopSpeaking(Speech.Boundary.Word) } catch(err){ 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.