テキストをオーディオ化

Final CUt Pro上のテキストインスペクタ内にあるText Areaのテキストを取得し、スクリプトへ転送。
スクリプトの“say”コマンドを使い、テキストをオーディオ化。
保存し、保存先を開くまでを自動化するものです。

-- Use this script as a wrapper for GUI Scripting statements when you are confident that GUI Scripting is available and enabled or that the user knows how to enable it if necessary

activate application "Final Cut Pro"
repeat with i from 1 to 10
repeat with ii from 1 to 10
tell application "System Events"
tell process "Final Cut Pro"
tell window "Final Cut Pro"
tell splitter group 1
tell group i of splitter group 1 of group ii of splitter group 1 of group 1
if exists checkbox "テキスト" of group 2 then
if (get value of checkbox "テキスト" of group 2) is 1 then
if exists text area 1 of scroll area 1 of scroll area 1 of group 1 then
set aValue to get value of text area 1 of scroll area 1 of scroll area 1 of group 1
if aValue is not "" then
saveAudioFile(aValue) of me
exit repeat
end if
end if
else
click checkbox "テキスト" of group 2
if exists text area 1 of scroll area 1 of scroll area 1 of group 1 then
set aValue to get value of text area 1 of scroll area 1 of scroll area 1 of group 1
if aValue is not "" then
saveAudioFile(aValue) of me
exit repeat
end if
end if
end if
end if
end tell
end tell
end tell
end tell
end tell
end repeat
end repeat

on saveAudioFile(aValue)
tell application "Finder"
set aFol to (path to desktop)
tell folder aFol
if not (exists folder "system voice.") then
make new folder at aFol with properties {name:"system voice."}
end if
end tell
end tell
say aValue
say aValue saving to (((path to desktop) as string) & "system voice.:" & aValue & ".aiff")
tell application "Finder"
open folder (((path to desktop) as string) & "system voice.:") as alias
activate
end tell
end saveAudioFile

更新履歴

inserted by FC2 system