Jump to content

Recommended Posts

Posted (edited)

intresting

but now works correctly

#include <WinAPI.au3>
#include "TTS UDF.au3"

Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
_Example()
Func _Example()
    Local $oSapi = _SpeechObject_Create()
    _SpeechObject_Say($oSapi , 'This is a simple TTS-UDF.')
EndFunc   ;==>_Example

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

and here is console output:

  Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\TTS UDF_Example.au3" /UserParams    
+>13:12:11 Starting AutoIt3Wrapper v.15.503.1200.4 SciTE v.3.5.4.0   Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0415)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\user\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\user\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.0)  from:C:\Program Files (x86)\AutoIt3  input:Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\TTS UDF_Example.au3
+>13:12:11 AU3Check ended.rc:0
>Running:(3.3.14.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\TTS UDF_Example.au3"    
--> Press Ctrl+F11 to Restart or Ctrl+Break -or- F11 to Stop
TTS UDF_Example.au3 (176) : ==> COM Error intercepted !
    err.number is:         0x80020005
    err.windescription:    Niedopasowanie typu. ==== Type mismatch.

    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     176
    err.retcode is:     0x00000000

TTS UDF_Example.au3 (177) : ==> COM Error intercepted !
    err.number is:         0x80020005
    err.windescription:    Niedopasowanie typu. ==== Type mismatch.

    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     177
    err.retcode is:     0x00000000

+>13:12:12 AutoIt3.exe ended.rc:0
+>13:12:12 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.344

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I dont know, what your ObjEvent Error function should do, but, if you use the example like this:

_Example()
Func _Example()
    Local $oSapi = _SpeechObject_Create()
    _SpeechObject_Say($oSapi , 'This is a simple TTS-UDF.')
    while NOT _SpeechObject_isReady($oSapi)
    WEnd
EndFunc   ;==>_Example

It works perfectly. I dont know, why it throws the error. (You need to keep the Script running, until reading is ready)

Normally the Error, youve got means SPCAT_VOICES,SPERR_NOT_FOUND -> there is no registryentry found with installed voices.

Edited by Kanashius
Posted

the problem is here:

Func _SpeechObject_Stop($oSpeech)
    $Output = $oSpeech.AudioOutput
    $Voice = $oSpeech.Voice
    $Rate = $oSpeech.Rate
    $Volume = $oSpeech.Volume
    $oSpeech = ObjCreate("SAPI.SpVoice")
    $oSpeech.AudioOutput = $oSpeech
    $oSpeech.Voice = $oSpeech
    $oSpeech.Rate = $Rate
    $oSpeech.Volume = $Volume
EndFunc   ;==>_SpeechObject_Stop

here is fix:

Func _SpeechObject_Stop($oSpeech)
    Local $Output = $oSpeech.AudioOutput
    Local $Voice = $oSpeech.Voice
    Local $Rate = $oSpeech.Rate
    Local $Volume = $oSpeech.Volume
    $oSpeech = ObjCreate("SAPI.SpVoice")
    $oSpeech.AudioOutput = $Output
    $oSpeech.Voice = $Voice
    $oSpeech.Rate = $Rate
    $oSpeech.Volume = $Volume
EndFunc   ;==>_SpeechObject_Stop

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

As I see today You share to the community, lots of interesting solutions.
Thanks a lot for that.

I suggest you to edit your signature by adding links to the UDF's.

 

btw.

upload them here:

https://www.autoitscript.com/forum/files/

 

and here is my contribution to TTS UDF

  Reveal hidden contents

 

UDF:

 

EXAMPLE:

 

Edited by mLipok
added spoiler, wording

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

so

I wish you breaking pen ..... (such a saying - to prosper)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 7/14/2015 at 3:39 PM, mLipok said:

I suggest you to edit your signature by adding links to the UDF's.

 

 

I see you edit your singature but I would suggest you to use "Link" button in "Forum Editor Toolbar".
In this way you be able to make signature like my or @Melba23 , and many other members.

btw.

I'm wondered whether the current form of your signature does not cause additional burden for the forum.
I wonder if all the links are dynamically generated even in the case when your "spoiler" is collapsed.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Great discussion Kanashius and mLipok! I appreciate the great UDF and examples.

Is it possible to use this to read a web page and have the text highlight for each word as it is being read?

Thank you!

Posted (edited)

Yes.

I think this can be one of examples but this need a time.
We are toogether (I and Kanashius) working on TTS UDF updated.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 5 years later...
Posted

hello everybody 

I've installed on my win 10 many lang voices but only English US is available for "SAPI.SpVoice"

here I can get available voices 

Dim $voic = ObjCreate("SAPI.SpVoice")
Dim $SOTokens = $Voic.GetVoices('', '')
For $Token In $SOTokens
        ConsoleWrite($Token.GetDescription & @LF)
Next

output 

Microsoft David Desktop - English (United States)
Microsoft Zira Desktop - English (United States)

although I've installed Arabic and British voices also

how to make all installed voices available for my script please?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...