Program integration

Here is a description of how I integrated the tts scripts into some programs for speech output

Opera

At the beginning, I used to copy the text out of Opera, pasted it into KMouth and let it speak. Then I remembered that one can customize the menus, and now I just have to select the text, right click on it and select "say"...

Example 1.5. /opt/opera/share/opera/ini/standard_menu.ini

...
[Hotclick Popup Menu]
Item, 50872 = Copy
Item, "Say" = "Copy & Execute program,"/home/cweiske/scripts/sayparam","%c"" 
Item, 67652 = Copy to note
...

The only thing missing is a second entry for english text, but that is coming soon I think.

KMouth

The KMouth program is for mutely people, but one can use it for easy tts reading. The only thing you have to set up is

Settings/KMouth/Text to speech/Command for talking. I set it to

echo "%t" | say

emerge

Like described in the tts introduction, I use the tts to tell me that emerging is done. For that I wrote a script called "em" and made a symlink into the bin directory so that I can use it everywhere.

Example 1.6. /home/scripts/cweiske/em

#!/bin/sh
# emerge it
emerge $*

#now say it
#we add a space before so that we can be sure to have a standalone -f parameter
allparams=" $* "

if [ `echo "$allparams" | grep -e ' -f ' | wc -l` = 1 ]; then
    #all downloaded
    text="Es wurde alles herunter geladen"
elif [ $# -eq 1 ] && [ $allparams = "sync" ]; then
    #sync complete
    text="Synchronisation abgeschlossen"
elif [ $1 = "search" ]; then
    #search complete, tell the number of found applications
    number=`emerge $* 2> /dev/null | grep "Applications found :" | sed 's/^.*: //' | sed 's/ ]//'`
    number=`echo $number | sed s/^0$/keine/`
    text="Bei der Suche wurden $number Programme gefunden"
else
    #normal installation
    text="Installation abgeschlossen"
fi
echo "$text" | /home/cweiske/scripts/say &> /dev/null &

I know that the thing with the number of found applications is really bad implemented, but I don't know how to display the output of emerge in color and capuring it the same time...