Originally posted by macvillage.net:
<STRONG>Problems:
I can't get path to "/System/Library/Speech/Voices"
I need to trim ".SpeechVoice" off of each item in the results.
Does anyone know how to fix these problems? I haven't been able to do the first one, and I don't know of an efficient (less than a billion line) method for the second either.</STRONG>
Try this for the path...
tell application "Finder"
to set tPath
to {name
of startup disk
as string, ":System:Library:Speech:Voices:"}
as string
A billion line method for the second one? You need to read about text manipulation
If your list of items is {"Victoria.SpeechVoice", "Ralph.SpeechVoice", "Cellos.SpeechVoice"} or whatever.. then try this...
set utVoices
to {"Victoria.SpeechVoice", "Ralph.SpeechVoice", "Cellos.SpeechVoice"}
set tVoices
to {}
repeat with aVoice
from 1
to length
of (items
of utVoices)
set end of tVoices
to (items 1
thru -13
of (item aVoice
of utVoices))
as string
end repeat
tVoices
Now.. to put it all together...
on run
tell application "Finder"
to set utVoices
to name
of every item
of folder ({(name
of startup disk)
as string, ":System:Library:Speech:Voices:"}
as string)
set tVoices
to {}
repeat with aVoice
from 1
to length
of (items
of utVoices)
set end of tVoices
to (items 1
thru -13
of (item aVoice
of utVoices))
as string
end repeat
return choose from list tVoices OK button name "Choose" with prompt "Select a voice"
end run
Keep in mind that has only been tested in OS 9.
Edit: I converted into hard spaces for the last part... I have a script that turns the clipboard into UBB.. but it also has ... or something..
[ 11-04-2001: Message edited by: Synotic ]