Speak selected text with different voices

I try to use KM to control speak selected text with different voice, but meet some issues :
1.how to detect selected text with KM?
2. how to detect selected text language (use first word of text to define the language),is it english or french,then I can use "if expression" to decide to use which voice to speak.
3. I find that not all the system voices choice in KM Speak list, for example the Voice "Susan" not on the KM Speak list .I don't know why.

The easiest way to have KM speak selected text is to copy the selection to the clipboard first:

I don't know of any way for KM to automatically detect what language is selected, so I would just duplicate this macros for each language you want spoken. If you assign each macro the same hotkey, you can choose which one you want from a conflict palette fairly quickly.

if I only want to detect two language : English and Chinese, since English is combine by alphabet , So is there a way to detect the clipboard start with alphabet?

If those are the only two languages you want to distinguish between, then yes, they're distinct enough that there's an easy way to do that with regex:

Speak Selected Text (English or Chinese).kmmacros (3.0 KB)

Feel free to change the voices used, of course.

1 Like