I'm running Mac OS 10.9 and I use the Text to Speech
feature which allows you to use a hotkey that reads selected text in any application. I use this feature for reading out-loud PDF documents in Preview (Apple's PDF viewer).
The problem is that the selected text usually has word-break hyphens. The result is the Text to Speech
feature doesn't read out the text properly.
Example:
Question:
Can you write me a short bash shell script that removes hyphens from the text in the clipboard? I will use automator too, so I can assign a hotkey, and to send the script's output to the Speak Text feature.
Edit: (in reply to goldilocks's comment) Automator allows me to copy selected text to the clipboard followed by a shell script followed by the Speak Text feature. See image below.
2nd Edit: in fact there might be a more concise way of accomplishing this:
under the 'Pass input' option there is a 'as argument' option. I'm not sure whether this means I can skip the 'copy to clipboard' action in the first image, but I thought I'd mention it just in case.
echo
command I used (in the photo above) successfully spoke the text, "clipboard text here"sed 's/- //'
would work, otherwise you need the longer one to deal with them.Speak Text
feature doesn't like formatted text. Is there code I can add so that the text piped toSpeak Now
isn't formatted? BTW, I genuinely appreciate the help.@Graeme
in your comment, I will get a notification for it.