如何下载发言权与AppleScript的功能,一个新的声音? [英] How to download a new voice for say's function with AppleScript?

查看:129
本文介绍了如何下载发言权与AppleScript的功能,一个新的声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找安装(2是精确的)对系统preferences不同的声音的方法。
声音是亚历克斯的英语语音和托马斯为法国的声音。

I'm searching a method to install different voices (2 to be exact) on the system preferences. The voices are "Alex" for an english voice and "Thomas" for a french voice.

我已经通过控制台直接尝试,但没有成功,这就是为什么我已经转向的AppleScript语言,但我从来没有使用过这种语言。

I've tried directly by console but didn't succeed, that's why I've turned to the AppleScript language, but I never used this language.

在code我已经为此刻正在

The code I've for the moment is

set osver to system version of (system info)
if osver is equal to "10.6.8" then
    display dialog ("Downloading voices is only available in OS X Lion and higher")
else
    tell application "System Preferences"
        activate
        reveal (pane id "com.apple.preference.speech")
    end tell

    try
        tell application "System Events"
            click radio button 2 of tab group 1 of window 1 of process "System Preferences"
            repeat until (exists pop up button of tab group 1 of window 1 of process "System Preferences")
                delay 2
            end repeat
            delay 2
            click pop up button 1 of tab group 1 of window 1 of process "System Preferences"
            delay 2
            click menu item -1 of menu 1 of pop up button of tab group 1 of window 1 of process "System Preferences"
            delay 2
        end tell
    on error
        display dialog ("An error happend")
    end try
end if

本程序打开声音窗口,但显示对话框每次出现什么指标,我把时间。

This program is opening the voice window but the display dialog appears every time whatever the index I put.

如果您有其他的想法来下载声音,或者如果你能帮助我理解什么是不工作的,我将非常感激。

If you have another idea to download the voices, or if you can help me to understand what is not working, I will be grateful.

推荐答案

这在10.9为我工作:

This worked for me in 10.9:

tell application "System Preferences"
    reveal anchor "TTS" of pane id "com.apple.preference.speech"
    activate
end tell
tell application "System Events" to tell window 1 of process "System Preferences"
    tell pop up button 1 of tab group 1
        click
        click menu item "Customize..." of menu 1
    end tell
    delay 1
    repeat with r in UI element 1 of rows of table 1 of scroll area 1 of sheet 1
        if exists static text 1 of r then
            if {"Alex", "Thomas"} contains value of static text 1 of r then
                if value of checkbox 1 of r is 0 then click checkbox 1 of r
            end if
        end if
    end repeat
    click button "OK" of sheet 1
end tell

花了多秒,但运行脚本。

It took multiple seconds to run the script though.

这篇关于如何下载发言权与AppleScript的功能,一个新的声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆