AppleScript名:すべてのTTS VoiceからLanguage情報を抽出してユニーク化 |
— Created 2015-08-25 by Takaaki Naganoya — Modified 2015-08-26 by Shane Stanley, Takaaki Naganoya — 2015 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set v1Res to getLocaleICodeFromTTSVoices() –> {"fr_FR", "zh_TW", "it_IT", "en_ZA", "es_AR", "ko_KR", "ro_RO", "en_IN", "fr_CA", "hi_IN", "da_DK", "en-scotland", "pt_BR", "zh_CN", "sv_SE", "es_ES", "ar_SA", "hu_HU", "en_GB", "ja_JP", "fi_FI", "zh_HK", "tr_TR", "nb_NO", "pl_PL", "id_ID", "cs_CZ", "el_GR", "he_IL", "ru_RU", "de_DE", "en_AU", "nl_BE", "pt_PT", "th_TH", "sk_SK", "en_US", "en_IE", "nl_NL", "es_MX"} set v2Res to getLanguageCodeFromTTSVoices() –> {"nl-NL", "id", "fr-FR", "it-IT", "es-419", "ko-KR", "ro-RO", "fr-CA", "hi-IN", "da-DK", "pt-BR", "sv-SE", "es-ES", "hu-HU", "en-GB", "ja-JP", "fi-FI", "tr-TR", "ar", "nb-NO", "pl-PL", "cs-CZ", "el-GR", "he-IL", "ru-RU", "zh-Hans", "de-DE", "en-AU", "zh-Hant", "nl-BE", "pt-PT", "th-TH", "sk-SK", "en-US", "en-IE"} on getLanguageCodeFromTTSVoices() set aResList to getAttributeFromTTSVoices("VoiceLanguage") of me return aResList as list end getLanguageCodeFromTTSVoices on getLocaleICodeFromTTSVoices() set aResList to getAttributeFromTTSVoices("VoiceLocaleIdentifier") of me return aResList as list end getLocaleICodeFromTTSVoices on getAttributeFromTTSVoices(anAttribute) set outArray to current application’s NSMutableArray’s new() set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDict to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDict) end repeat set aResArray to (outArray’s valueForKey:anAttribute) set aSet to current application’s NSMutableSet’s setWithArray:aResArray set aResList to aSet’s allObjects() return aResList as list end getAttributeFromTTSVoices |
More from my site
(Visited 66 times, 1 visits today)