Seite 1 von 1

Voice SAPI

Verfasst: Di, 10. Apr 2018 5:33
von AUGE_OHR
moin,

es geht mir um die Stimme bei der Ausgabe

Code: Alles auswählen

   oApp := CreateObject( "SAPI.SpVoice" )
   oVoice := oApp:GetVoices()
oApp ist das ActiveX
SAPIspVoice.jpg
SAPIspVoice.jpg (35.24 KiB) 4502 mal betrachtet
oVoice ist nun ein Object zum ISpeechObjectTokens Interface
https://msdn.microsoft.com/de-de/librar ... s.85).aspx
ISpeechObjectTokens.jpg
ISpeechObjectTokens.jpg (35.23 KiB) 4502 mal betrachtet

Code: Alles auswählen

   iMax := oVoice:getProperty("Count")
   FOR i := 1 TO iMax
      oItem := oVoice:CallMethod("Item",i-1)
      AADD(aVoice, oItem )
   NEXT
die einzelnen oItems sind die ISpeechObjectToken (ohne "s" am Ende) Interface Objecte
https://msdn.microsoft.com/de-de/librar ... s.85).aspx
ISpeechObjectToken.jpg
ISpeechObjectToken.jpg (35.01 KiB) 4502 mal betrachtet
unter Methods gibt es nun "GetDescription Method" (hab es auch als Property versucht)
https://msdn.microsoft.com/de-de/librar ... s.85).aspx

Code: Alles auswählen

   iMax := LEN(aVoice)
   FOR i := 1 TO iMax
#IFDEF Try
      IF IsMethod( aVoice[i],"GetDescription")
          cText := aVoice[i]:CallMethod("GetDescription")
#ELSE
      IF IsMemberVar(aVoice[i],"GetDescription")
         cText := aVoice[i]:getProperty("GetDescription")
#ENDIF
      ENDIF
   NEXT
weder IsMethod() noch IsMemberVar() reagieren auf "GetDescription" :angry4:

jemand eine Idee was da schief läuft :?:

Re: Voice SAPI

Verfasst: Di, 10. Apr 2018 6:06
von AUGE_OHR
so hab eine Lösung gefunden

Code: Alles auswählen

   iMax := LEN(aVoice)
   FOR i := 1 TO iMax
      nID := aVoice[i]:getIDsOfNames("GetDescription")
      IF !EMPTY(nID)
         cDescript := aVoice[i]:CallMethod(nID)
ich bekomme mit o:getIDsOfNames() für nID eine Nummer also die in CallMethod() eingesetzt und siehe da es funktioniert =D>