Hi Jean-Marc,
the only way I found to get at the speechRate is via applescript and graphical user interface scripting (GUI scripting). This is always "ugly". It only works if the preference panes stay the same across system versions etc.
I tried to get at the pList. As it turns out the speech rate in system preferences and in the pList are not the same. I suspect there is a value in the pList that depends on the voice the user has chosen. So scripting the system preferences was the only consistent way.
Maybe someone finds a more elegant way (shell anyone?)
You have to decide whether you want to go with this script or you find it too complicated to test for all the System versions if it works. It works for me OSX 10.6.4. I guess it will work in other versions, but I can not test it right now.
For this script to work in system preferences you have to turn on in Accès universel: Activer l'acces pour les péripheriques d'aide
The script uses numbers instead of name of objects to be independent of the chosen language.
Code: Select all
tell application "System Preferences"
set current pane to pane "com.apple.preference.speech"
delay 0.5 -- adjust in case to fast
end tell
tell application "System Events"
tell application process "System Preferences"
tell window 1 --"Sprache" language
tell tab group 1
click radio button 2
delay 0.5 -- adjust in case to fast
tell slider 1
tell attribute 13
set x to value
end tell
end tell
end tell
end tell
end tell
end tell
tell application "System Preferences" to quit
return x
put this into a field, make a second field and a button
script of button:
Code: Select all
on mouseUp
put field 1 into tAS
do tAS as applescript
put the result into tSpeechRate
put tSpeechRate into field 2
end mouseUp
I attach the stack that works for me (attention, there is no errorchecking in both scripts, you might have to adjust the delays if half a second is not enough on a very slow machine)
regards, et bonne chance
Bernd
EDIT: see below for a newer version