Jump to content

Recommended Posts

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:

>"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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

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
Link to post
Share on other sites

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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

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

 

UDF:

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.10.2
    Author:         Kanashius
    Rights:      Open Source UDF
    Script Function:
    UDF zum wiedergeben von Text mittels Text-To-Speech
#ce ----------------------------------------------------------------------------
#include <WinAPI.au3>

#Region - SpeechVoiceEvents Enum
;~ https://msdn.microsoft.com/en-us/library/ms720886(v=vs.85).aspx
Global Const $SVEStartInputStream = 2 ; Represents the StartStream event, which occurs when the engine begins speaking a stream.
Global Const $SVEEndInputStream = 4 ; Represents the EndStream event, which occurs when the engine encounters the end of a stream while speaking.
Global Const $SVEVoiceChange = 8 ; Represents the VoiceChange event, which occurs when the engine encounters a change of Voice while speaking.
Global Const $SVEBookmark = 16 ; Represents the Bookmark event, which occurs when the engine encounters a bookmark while speaking.
Global Const $SVEWordBoundary = 32 ; Represents the WordBoundary event, which occurs when the engine completes a word while speaking.
Global Const $SVEPhoneme = 64 ; Represents the Phoneme event, which occurs when the engine completes a phoneme while speaking.
Global Const $SVESentenceBoundary = 128 ; Represents the SentenceBoundary event, which occurs when the engine completes a sentence while speaking.
Global Const $SVEViseme = 256 ; Represents the Viseme event, which occurs when the engine completes a viseme while speaking.
Global Const $SVEAudioLevel = 512 ; Represents the AudioLevel event, which occurs when the engine has completed an audio level change while speaking.
Global Const $SVEPrivate = 32768 ; Represents a private engine event.
Global Const $SVEAllEvents = 33790 ; Represents all speech voice events.
#EndRegion - SpeechVoiceEvents Enum

#Region - SpeechVoiceSpeakFlags Enum
; https://msdn.microsoft.com/en-us/library/ms720892(v=vs.85).aspx
; SpVoice Flags
Global Const $SVSFDefault = 0 ; Specifies that the default settings should be used. The defaults are:
;                                      - To speak the given text string synchronously (override with SVSFlagsAsync),
;                                      - Not to purge pending speak requests (override with SVSFPurgeBeforeSpeak),
;                                      - To parse the text as XML only if the first character is a left-angle-bracket (override with SVSFIsXML or SVSFIsNotXML),
;                                      - Not to persist global XML state changes across speak calls (override with SVSFPersistXML), and
;                                      - Not to expand punctuation characters into words (override with SVSFNLPSpeakPunc).
Global Const $SVSFlagsAsync = 1 ; Specifies that the Speak call should be asynchronous. That is, it will return immediately after the speak request is queued.
Global Const $SVSFPurgeBeforeSpeak = 2 ; Purges all pending speak requests prior to this speak call.
Global Const $SVSFIsFilename = 4 ; The string passed to the Speak method is a file name rather than text. As a result, the string itself is not spoken but rather the file the path that points to is spoken.
Global Const $SVSFIsXML = 8 ; The input text will be parsed for XML markup.
Global Const $SVSFIsNotXML = 16 ; The input text will not be parsed for XML markup.
Global Const $SVSFPersistXML = 32 ; Global state changes in the XML markup will persist across speak calls.

; Normalizer Flags
Global Const $SVSFNLPSpeakPunc = 64 ; Punctuation characters should be expanded into words (e.g. "This is it." would become "This is it period").

; TTS Format
;~ Global Const $SVSFParseSapi = ; Force XML parsing as MS SAPI.
;~ Global Const $SVSFParseSsml = ; Force XML parsing as W3C SSML.
;~ Global Const $SVSFParseAutoDetect = ; The TTS XML format is auto-detected. This is the default if none of these TTS XML format values are present in the bit-field.

; Masks
Global Const $SVSFNLPMask = 64 ; Flags handled by SAPI (as opposed to the text-to-speech engine) are set in this mask.
;~ SVSFParseMask = ; SVSFParseSapi|SVSFParseSsml
Global Const $SVSFVoiceMask = 127 ; This is an existing SAPI 5.1 mask that has every flag bit set. In 5.3, it has been extended to contain SVSFParseMask.
Global Const $SVSFUnusedFlags = -128 ; This mask has every unused bit set.
#EndRegion - SpeechVoiceSpeakFlags Enum


; #CURRENT# =====================================================================================================================
; _SpeechObject_Create
; _SpeechObject_Say
; _SpeechObject_setRate
; _SpeechObject_SetVolume
; _SpeechObject_SetVoice
; _SpeechObject_SetOutput
; _SpeechObject_Pause
; _SpeechObject_Resume
; _SpeechObject_Stop
; _SpeechObject_isReady
; _SpeechObject_getOutputsName
; _SpeechObject_getVoicesName
; ===============================================================================================================================

;===============================================================================
;
; Function Name:    _SpeechObject_Create()
; Description:      Create TTS-Object
; Parameter(s):     none.
; Requirement(s):   none.
; Return Value(s):  Returns an Object
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_Create()
    $oSpeech = ObjCreate('SAPI.SpVoice')
    If @error Then
        Return -1
    EndIf
    $oSpeech.Rate = 1
    $oSpeech.Volume = 100
    Return $oSpeech
EndFunc   ;==>_SpeechObject_Create

;===============================================================================
;
; Function Name:    _SpeechObject_Say()
; Description:      Read a text.
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $sText - String to read
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_Say(ByRef $oSpeech, $sText)
    _SpeechObject_Stop($oSpeech)
    $oSpeech.Speak($sText, $SVSFlagsAsync + $SVSFPurgeBeforeSpeak)
EndFunc   ;==>_SpeechObject_Say

;===============================================================================
;
; Function Name:    _SpeechObject_setRate()
; Description:      Set Rate of an Speech-Object (reading-speed)
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $iRate - Int Between -10 and 10
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_SetRate(ByRef $oSpeech, $iRate)
    $oSpeech.Rate = $iRate
EndFunc   ;==>_SpeechObject_SetRate

;===============================================================================
;
; Function Name:    _SpeechObject_SetVolume()
; Description:      Set the Volume of the Speech-Object
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $iVolume - int between 0 and 100
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_SetVolume(ByRef $oSpeech, $iVolume)
    If $iVolume < 0 Then Return SetError(1)
    If $iVolume > 100 Then Return SetError(2)
    $oSpeech.Volume = $iVolume
EndFunc   ;==>_SpeechObject_SetVolume

;===============================================================================
;
; Function Name:    _SpeechObject_SetVoice()
; Description:      Set the voice of the Speech-Object.
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $sName - Name (String) of an Voice as returned by _SpeechObject_getVoicesName()
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_SetVoice(ByRef $oSpeech, $sName)
    Dim $SOTokens = $oSpeech.GetVoices('', '')
    For $Token In $SOTokens
        If $Token.GetDescription = $sName Then
            $oSpeech.Voice = $Token
        EndIf
    Next
EndFunc   ;==>_SpeechObject_SetVoice

;===============================================================================
;
; Function Name:    _SpeechObject_SetOutput()
; Description:      Set the Output of the Speech-Object.
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $sName - Name (String) of an Outputdevice as returned by _SpeechObject_getOutputsName()
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_SetOutput(ByRef $oSpeech, $sName)
    Dim $SOTokens = $oSpeech.GetAudioOutputs('', '')
    For $Token In $SOTokens
        If $Token.GetDescription = $sName Then
            $oSpeech.AudioOutput = $Token
        EndIf
    Next
EndFunc   ;==>_SpeechObject_SetOutput

;===============================================================================
;
; Function Name:    _SpeechObject_Pause()
; Description:      Pauses the Speech-Object while reading.
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_Pause(ByRef $oSpeech)
    $oSpeech.Pause()
EndFunc   ;==>_SpeechObject_Pause

;===============================================================================
;
; Function Name:    _SpeechObject_Resume()
; Description:      Resumes the Speech-Object when it is paused.
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_Resume(ByRef $oSpeech)
    $oSpeech.Resume()
EndFunc   ;==>_SpeechObject_Resume

;===============================================================================
;
; Function Name:    _SpeechObject_Stop()
; Description:      Stops an Speech-Obekt while reading
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_Stop(ByRef $oSpeech)
    $oSpeech.Speak('', $SVSFlagsAsync + $SVSFPurgeBeforeSpeak)
EndFunc   ;==>_SpeechObject_Stop

;===============================================================================
;
; Function Name:    _SpeechObject_isReady()
; Description:      Check if the Speech-Object is ready.
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
; Requirement(s):   none.
; Return Value(s):  true - if Speech-Object is ready
;                   false - if Speech-Object is reading
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_isReady(ByRef $oSpeech)
    If _WinAPI_WaitForSingleObject($oSpeech.SpeakCompleteEvent, 0) <> 258 Then
        Return True
    EndIf
EndFunc   ;==>_SpeechObject_isReady

;===============================================================================
;
; Function Name:    _SpeechObject_getOutputsName()
; Description:      Return the Names of all avaible AudioOutput-Devices
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $bAsArray - true if names have to be returned as an Array
; Requirement(s):   none.
; Return Value(s):  String where the Devicenames are seperated with a "|"
;                   or Array with Names.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_getOutputsName(ByRef $oSpeech, $bAsArray = False)
    Dim $SOTokens = $oSpeech.GetAudioOutputs('', '')
    $sString = ""
    For $Token In $SOTokens
        $sString &= "|" & $Token.GetDescription
    Next
    $sString = StringTrimLeft($sString, 1)
    If $bAsArray Then
        Return StringSplit($sString, "|", 2)
    Else
        Return $sString
    EndIf
EndFunc   ;==>_SpeechObject_getOutputsName

;===============================================================================
;
; Function Name:    _SpeechObject_getVoicesName()
; Description:      Return the Names of all avaible Voices
; Parameter(s):     $oSpeech - SpeechObejct as returned by _SpeechObject_Create()
;                   $bAsArray - true if names have to be returned as an Array
; Requirement(s):   none.
; Return Value(s):  String where the Voicenames are seperated with a "|"
;                   or Array with Names.
; Author(s):        Kanashius
;
;===============================================================================
Func _SpeechObject_getVoicesName(ByRef $oSpeech, $bAsArray = False)
    Dim $SOTokens = $oSpeech.GetVoices('', '')
    $sString = ""
    For $Token In $SOTokens
        $sString &= "|" & $Token.GetDescription
    Next
    $sString = StringTrimLeft($sString, 1)
    If $bAsArray Then
        Return StringSplit($sString, "|", 2)
    Else
        Return $sString
    EndIf
EndFunc   ;==>_SpeechObject_getVoicesName

; #FUNCTION# ====================================================================================================================
; Name ..........: _SpeechObject_EVENT_
; Description ...:
; Syntax ........: _SpeechObject_EVENT_($sEventName)
; Parameters ....: $sEventName          - a string value.
; Return values .: none
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://msdn.microsoft.com/en-us/library/ms723587(v=vs.85).aspx
; Example .......: No
; ===============================================================================================================================
Func _SpeechObject_EVENT_($sEventName)
    ; TODO Events
    __SpeechObject_Notify('Event "Uncatched" was fired : $sEventName = ' & $sEventName & @CR)
EndFunc   ;==>_SpeechObject_EVENT_

; #FUNCTION# ====================================================================================================================
; Name ..........: _SpeechObject_EVENT_AudioLevel
; Description ...:
; Syntax ........: _SpeechObject_EVENT_AudioLevel(Byref $iStreamNumber, Byref $dStreamPosition, Byref $iAudioLevel)
; Parameters ....: $iStreamNumber       - [in/out] an integer value.
;                  $dStreamPosition     - [in/out] a binary variant value.
;                  $iAudioLevel         - [in/out] an integer value.
; Return values .: none
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://msdn.microsoft.com/en-us/library/ms723582(v=vs.85).aspx
; Example .......: No
; ===============================================================================================================================
Func _SpeechObject_EVENT_AudioLevel1(ByRef $iStreamNumber, ByRef $dStreamPosition, ByRef $iAudioLevel)
    __SpeechObject_Notify( _
            '_SpeechObject_EVENT_AudioLevel:' & @CRLF & _
            '$iStreamNumber =' & $iStreamNumber & @CRLF & _
            '$dStreamPosition =' & $dStreamPosition & @CRLF & _
            '$iAudioLevel = ' & $iAudioLevel & @CRLF & _
            @CRLF)
EndFunc   ;==>_SpeechObject_EVENT_AudioLevel1

; #FUNCTION# ====================================================================================================================
; Name ..........: _SpeechObject_EVENT_Word
; Description ...:
; Syntax ........: _SpeechObject_EVENT_Word(Byref $iStreamNumber, Byref $dStreamPosition, Byref $iCharacterPosition, Byref $iLength)
; Parameters ....: $iStreamNumber       - [in/out] an integer value.
;                  $dStreamPosition     - [in/out] a binary variant value.
;                  $iCharacterPosition  - [in/out] an integer value.
;                  $iLength             - [in/out] an integer value.
; Return values .: none
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://msdn.microsoft.com/en-us/library/ms723593(v=vs.85).aspx
; Example .......: No
; ===============================================================================================================================
Func _SpeechObject_EVENT_Word(ByRef $iStreamNumber, ByRef $dStreamPosition, ByRef $iCharacterPosition, ByRef $iLength)
    __SpeechObject_Notify( _
            '_SpeechObject_EVENT_Word:' & @CRLF & _
            '$iStreamNumber = ' & $iStreamNumber & @CRLF & _
            '$dStreamPosition = ' & $dStreamPosition & @CRLF & _
            '$iCharacterPosition = ' & $iCharacterPosition & @CRLF & _
            '$iLength = ' & $iLength & @CRLF & _
            @CRLF)
EndFunc   ;==>_SpeechObject_EVENT_Word

; #FUNCTION# ====================================================================================================================
; Name ..........: _SpeechObject_EVENT_Sentence
; Description ...:
; Syntax ........: _SpeechObject_EVENT_Sentence(Byref $iStreamNumber, Byref $dStreamPosition, Byref $iCharacterPosition,
;                  Byref $iLength)
; Parameters ....: $iStreamNumber       - [in/out] an integer value.
;                  $dStreamPosition     - [in/out] a binary variant value.
;                  $iCharacterPosition  - [in/out] an integer value.
;                  $iLength             - [in/out] an integer value.
; Return values .: none
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://msdn.microsoft.com/en-us/library/ms723589(v=vs.85).aspx
; Example .......: No
; ===============================================================================================================================
Func _SpeechObject_EVENT_Sentence(ByRef $iStreamNumber, ByRef $dStreamPosition, ByRef $iCharacterPosition, ByRef $iLength)
    __SpeechObject_Notify( _
            '_SpeechObject_EVENT_Sentence:' & @CRLF & _
            '$iStreamNumber = ' & $iStreamNumber & @CRLF & _
            '$dStreamPosition = ' & $dStreamPosition & @CRLF & _
            '$iCharacterPosition = ' & $iCharacterPosition & @CRLF & _
            '$iLength = ' & $iLength & @CRLF & _
            @CRLF)
EndFunc   ;==>_SpeechObject_EVENT_Word

; #FUNCTION# ====================================================================================================================
; Name ..........: _SpeechObject_EVENT_EndStream
; Description ...:
; Syntax ........: _SpeechObject_EVENT_EndStream(Byref $iStreamNumber, Byref $dStreamPosition)
; Parameters ....: $iStreamNumber       - [in/out] an integer value.
;                  $dStreamPosition     - [in/out] a binary variant value.
; Return values .: none
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://msdn.microsoft.com/en-us/library/ms723585(v=vs.85).aspx
; Example .......: No
; ===============================================================================================================================
Func _SpeechObject_EVENT_EndStream(ByRef $iStreamNumber, ByRef $dStreamPosition)
    __SpeechObject_Notify( _
            '_SpeechObject_EVENT_EndStream:' & @CRLF & _
            '$iStreamNumber = ' & $iStreamNumber & @CRLF & _
            '$dStreamPosition = ' & $dStreamPosition & @CRLF & _
            @CRLF)
EndFunc   ;==>_SpeechObject_EVENT_Word

Func _SpeechObject_UseComEventHandler(ByRef $oSpeech)
    Local $oSpeech_EventHandler = ObjEvent($oSpeech, '_SpeechObject_EVENT_', '_ISpeechVoiceEvents')
    Return $oSpeech_EventHandler
EndFunc   ;==>_SpeechObject_EnableEventHandler

Func _SpeechObject_UseComErrorHandler()
    Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
    Return $oErrorHandler
EndFunc   ;==>_SpeechObject_EnableEventHandler

Func _SpeechObject_NotifySetting($bNotify = Default)
    Local Static $bNotify_Static = False
    If $bNotify = Default Then
        Return $bNotify_Static
    ElseIf IsBool($bNotify) Then
        $bNotify_Static = $bNotify
        Return $bNotify_Static
    Else
        Return SetError(1, 0, $bNotify_Static)
    EndIf

EndFunc   ;==>__SpeechObject_Notify

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __SpeechObject_Notify
; Description ...:
; Syntax ........: __SpeechObject_Notify($sText)
; Parameters ....: $sText               - a string value.
; Return values .: none
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __SpeechObject_Notify($sText)
    If _SpeechObject_NotifySetting() Then
        ConsoleWrite($sText & @CRLF)
    EndIf
EndFunc

 

EXAMPLE:

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

_Example()
Func _Example()
    Local $oSpeech = _SpeechObject_Create()
    _SpeechObject_NotifySetting(True)
    Local $oSpeech_ComErrorHandler = _SpeechObject_UseComErrorHandler()
    Local $oSpeech_ComEventHandler = _SpeechObject_UseComEventHandler($oSpeech)

;~  ObjName_FlagsValue($oSpeech)
    _SpeechObject_Say($oSpeech, 'This is a simple Text To Speech example.')
    While Not _SpeechObject_isReady($oSpeech)
        Sleep(12)
        _SpeechObject_SetVolume($oSpeech, $oSpeech.Volume - 1)
    WEnd
;~  MsgBox(0, '', StringReplace( _SpeechObject_getVoicesName($oSpeech),'|',@LF))

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

 

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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

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 * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites
  • 5 years later...

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?

Link to post
Share on other sites

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Hermes
      Hi, I am struggling in setting the value of a textarea based on the value of clipboard (that contains a long web page source codes). If I use _WD_SetElementValue, it freezes after some time, or appears to be pressing tab and goes out of focus. I can also use send keys but i need the script to run in the background.
      Here is the full script:
      #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "WinHttp.au3" #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <AutoItConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <Excel.au3> Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "http://demo.borland.com/testsite/stadyn_largepagewithimages.html") _WD_LoadWait($sSession) Global $sSource = _WD_GetSource($sSession) Local $Paste = ClipPut($sSource) Local $sData = ClipGet() Local $aArray = 0, _ $iOffset = 1 While 1 $aArray = StringRegExp($sData, '(?s)<p>.*</p>', $STR_REGEXPARRAYMATCH, $iOffset) If @error Then ExitLoop $iOffset = @extended For $i = 0 To UBound($aArray) - 1 Local $Paste = ClipPut($aArray[$i]) Local $sRegExData = ClipGet() ;MsgBox(0, "", "$sRegExData = " & $sRegExData) Next WEnd _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_placeholder") _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") Local $sElement1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") _WD_FrameEnter($sSession, $sElement1) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") $textarea = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") _WD_ElementAction($sSession, $textarea, 'click') ;WD SetElementValue(SsSession, Stextarea, $sRegExData) <-- I can do this but the focus goes out, or the browser freezes _WD_FrameLeave($sSession) sleep(2000) Send("^v") _WD_LoadWait($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome Can someone help me please, or re-direct me to the right path? TIA!
    • By Hermes
      Hi, I am trying to select elements in print page (dialog window) for a specific web page. But when trying to do so, it looks like it does not allow me to do it.
      So far, this is what I have:
      _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $mainpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $mainpagebody, 2) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") Local $printbutton = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") _WD_ElementAction($sSession, $printbutton, 'click') _WD_LoadWait($sSession) Sleep(3000) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $printpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $printpagebody, 2) The script above highlights the main web page "body" element, then clicks a tag to print a specific part of the page, then it will open a print page window where i am trying to highlight the body of that print page - but it looks like it is dropping from the session because it opens up another chrome page chrome://print.
       
      Below is the output log:
      __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element/eb9e4673-4dec-4d4c-be6a-b7967743394b/click; $sData={"id":"eb9e4673-4dec-4d4c-be6a-b7967743394b"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... __WD_Post ==> Webdriver Exception: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C63733+2504499]\n\tOrdinal0 [0x00BFC401+2081793]\n\tOrdinal0 [0x00B024F0+1058032]\n\tOrdinal0 [0x00B55685+1398405]\n\tOrdinal0 [0x00B45E83+1334915]\n\tOrdinal0 [0x00B54CDB+1395931]\n\tOrdinal0 [0x00B45D4B+1334603]\n\tOrdinal0 [0x00B222B4+1188532]\n\tOrdinal0 [0x00B23149+1192265]\n\tGetHandleVerifier [0x00DDFB8C+1512252]\n\tGetHandleVerifier [0x00E8B0DF+2214031]\n\tGetHandleVerifier [0x00CE4BC3+484211]\n\tGetHandleVerifier [0x00CE3E69+480793]\n\tOrdinal0 [0x00C0218D+2105741]\n\tOrdinal0 [0x00C066E8+2123496]\n\tOrdinal0 [0x00C06827+2123815]\n\tOrdinal0 [0x00C0FB73+2161523]\n\tBaseThreadInitThunk [0x75EB62C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B34+1028]\n"}} _WD_ExecuteScript: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... _WD_ExecuteScript ==> Webdriver Exception: HTTP status = 500 _WD_LoadWait ==> Webdriver Exception __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}...  
      Is it even possible to select elements in print page?

    • By walec
      Hello
      How can I export a sheet to pdf using the OOoCalc.au3 UDF?
      Thank you for any hints or possibly other solutions / functions.
    • By p4sCh
      Hello everyone,
      I've created a UDF for basic communication with SSH servers. I know there is already such a UDF, but I wasn't satisfied with it for my purpose, so I created a new one.
      This UDF also acts as a wrapper for the plink executable. Its essential functions are _SSHConnect, _SSHSend, _SSHRecv and _SSHCloseSocket.
      It does support multiple simultaneous connections and aims to be pretty robust. Feel free to share your opinions
      Two of the included examples use a slightly modified version of Vintage Terminal by @Chimp
      Download
      The download includes ssh.au3 (UDF), plink.exe (necessary), vintage terminal and code examples:
      Version 1.0.1
      - fixed rare _SSHConnect bug where "ssh-host-key prompt" was not answered
      SSH UDF 1.0.1.zip
       
    • By water
      I have started to rewrite the PowerPoint UDF similar to the Word, Excel and Outlook UDF. The new UDF will not be compatible with the existing one.
      I will add examples, documentation, a section in the wiki etc.
      So far the following functions have been coded - more are on the ToDo list.
      _PPT_Open: Open a connection to a running instance of PowerPoint or start a new one _PPT_Close: Close a PowerPoint instance _PPT_CommentAdd: Add a Comment anywhere on a Slide or connected to a Shape (version 1.5.0.0 2021-08-31) _PPT_CommentDelete: Delete a single Comment from a Slide or all Comments from a SlideRange (version 1.5.0.0 2021-08-31) _PPT_CommentList: Get a list of all Comments in a Presentation (version 1.5.0.0 2021-08-31) _PPT_ConvertUnits: Convert units (like centimeters) to other units (like points) (version 1.3.0.0 2021-08-17) _PPT_HeaderFooterList: Returns a list of Headers and Footers for a Presentation (version 1.1.0.0 2021-07-25, removed with version 1.4.0.0 2021-08-25) _PPT_HeaderFooterSet: Sets the Header/Footer for a Slide/Slides or the Slide-/Notes-/Handout-/Title-Master of the Presentation (version 1.2.0.0 2021-08-09) _PPT_PresentationAttach: Attach to an already opened Presentation _PPT_PresentationClose: Close a Presentation _PPT_PresentationExport: Export one/multiple/all Slides as PDF or XPS. _PPT_PresentationExportGraphic: Export one/multiple/all Slides in a graphic format. _PPT_PresentationList: Returns a list of currently open Presentations (version 1.0.0.0 2021-07-20) _PPT_PresentationNew: Create a new Presentation _PPT_PresentationOpen: Open an existing Presentation _PPT_Print: Print one/multiple/all Slides of a Presentation (version 1.0.0.0 2021-07-20) _PPT_PresentationSave: Save a Presentation _PPT_PresentationSaveAs: Save a Presentation to another location or with another type _PPT_ShapeAdd: Add a Shape to a single or multiple Slides (version 1.1.0.0 2021-07-25) _PPT_ShapeAlignDistribute: Aligns and distributes the Shapes in the specified ShapeRange (version 1.6.0.0 - to be released) _PPT_ShapeCopyMove: Copy/move a Shape(s) of a single Slide to a Slide(s) in the same or a different Presentation (version 1.1.0.0 2021-07-25) _PPT_ShapeDelete: Delete a Shape or Shapes from a single or multiple Slides (version 1.1.0.0 2021-07-25) _PPT_SlideAdd: Add slide(s) to a Presentation _PPT_SlideCopyMove: Copy, move, duplicate Slide(s) _PPT_SlideDelete: Delete Slide(s) _PPT_SlideShow: Show a Presentation _PPT_TableGet: Extract data from a PowerPoint Table Shape to an array (version 1.3.0.0 2021-08-17) _PPT_TableSet: Write data to a PowerPoint Table Shape (version 1.3.0.0 2021-08-17) _PPT_TextFindReplace: Find & replace text throughout entire PowerPoint presentation (version 1.0.0.0 2021-07-20) _PPT_TextSet: Sets/modifies the Text of a Shape or Shapes of a single or multiple Slides (version 1.2.0.0 2021-08-09 Which functions do you want me to add to the UDF?
      ToDo list:
      create slide (JLogan3o13) - Done: _PPT_SlideAdd Apply template to slide (JLogan3o13) - Done: _PPT_SlideAdd Apply theme to slide (JLogan3o13) Cut/Copy/Duplicate/Move/Delete slide(s) (JLogan3o13) - Done: _PPT_SlideCopyMove, _PPT_SlideDelete Export slides (JLogan3o13) - Done: _PPT_PresentationExport Cut/Copy/Duplicate/Move/Delete shape(s) (JLogan3o13): Done : _PPT_ShapeCopyMove, _PPT_ShapeDelete (version 1.1.0.0 2021-07-25) ApplyAnimation, Select, SetDefaultProperties, and zOrder for shape(s) (JLogan3o13) Searching and replacing text (pcjunki) - Done: _PPT_TextFindReplace (version 1.0.0.0 2021-07-20) Export slides in a graphic format (JPG, GIF, PNG ...) (UEZ) - Done: _PPT_PresentationExportGraphic The UDF can be downloaded from the download forum.
       
×
×
  • Create New...