Jump to content
Kanashius

TTS UDF

Recommended Posts

mLipok

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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
Kanashius

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

Share this post


Link to post
Share on other sites
mLipok

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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

so

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

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
coffeeturtle

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!

Share this post


Link to post
Share on other sites
mLipok

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
  • Like 1

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 API *

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 *

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 * 

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) * 

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 *

"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: 2018-03-17

Share this post


Link to post
Share on other sites
coffeeturtle

Awesome! thanks! I will follow this thread.

Share this post


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

  • Similar Content

    • ScriptJunky
      By ScriptJunky
      I noticed a lack of a constants file for _WinAPI_GetSystemMetrics() so I made this for anyone who wants to add it to their library. Enjoy!  (file attached below)
      #include-once ; #INDEX# ======================================================================================================================= ; Title .........: WinAPI GetSystemMetrics Constants ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Description ...: Constants for _WinAPI_GetSystemMetrics(). ; Author(s) .....: ScriptJunky ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== ; _WinAPI_GetSystemMetrics() Global Const $ARRANGE = 56 Global Const $CLEANBOOT = 67 Global Const $CMONITORS = 80 Global Const $CMOUSEBUTTONS = 43 Global Const $CONVERTIBLESLATEMODE = 0x2003 Global Const $CXBORDER = 5 Global Const $CXCURSOR = 13 Global Const $CXDLGFRAME = 7 Global Const $CXDOUBLECLK = 36 Global Const $CXDRAG = 68 Global Const $CXEDGE = 45 Global Const $CXFIXEDFRAME = 7 Global Const $CXFOCUSBORDER = 83 Global Const $CXFRAME = 32 Global Const $CXFULLSCREEN = 16 Global Const $CXHSCROLL = 21 Global Const $CXHTHUMB = 10 Global Const $CXICON = 11 Global Const $CXICONSPACING = 38 Global Const $CXMAXIMIZED = 61 Global Const $CXMAXTRACK = 59 Global Const $CXMENUCHECK = 71 Global Const $CXMENUSIZE = 54 Global Const $CXMIN = 28 Global Const $CXMINIMIZED = 57 Global Const $CXMINSPACING = 47 Global Const $CXMINTRACK = 34 Global Const $CXPADDEDBORDER = 92 Global Const $CXSCREEN = 0 Global Const $CXSIZE = 30 Global Const $CXSIZEFRAME = 32 Global Const $CXSMICON = 49 Global Const $CXSMSIZE = 52 Global Const $CXVIRTUALSCREEN = 78 Global Const $CXVSCROLL = 2 Global Const $CYBORDER = 6 Global Const $CYCAPTION = 4 Global Const $CYCURSOR = 14 Global Const $CYDLGFRAME = 8 Global Const $CYDOUBLECLK = 37 Global Const $CYDRAG = 69 Global Const $CYEDGE = 46 Global Const $CYFIXEDFRAME = 8 Global Const $CYFOCUSBORDER = 84 Global Const $CYFRAME = 33 Global Const $CYFULLSCREEN = 17 Global Const $CYHSCROLL = 3 Global Const $CYICON = 12 Global Const $CYICONSPACING = 39 Global Const $CYKANJIWINDOW = 18 Global Const $CYMAXIMIZED = 62 Global Const $CYMAXTRACK = 60 Global Const $CYMENU = 15 Global Const $CYMENUCHECK = 72 Global Const $CYMENUSIZE = 55 Global Const $CYMIN = 29 Global Const $CYMINIMIZED = 58 Global Const $CYMINSPACING = 48 Global Const $CYMINTRACK = 35 Global Const $CYSCREEN = 1 Global Const $CYSIZE = 31 Global Const $CYSIZEFRAME = 33 Global Const $CYSMCAPTION = 51 Global Const $CYSMICON = 50 Global Const $CYSMSIZE = 53 Global Const $CYVIRTUALSCREEN = 79 Global Const $CYVSCROLL = 20 Global Const $CYVTHUMB = 9 Global Const $DBCSENABLED = 42 Global Const $DEBUG = 22 Global Const $DIGITIZER = 94 Global Const $IMMENABLED = 82 Global Const $MAXIMUMTOUCHES = 95 Global Const $MEDIACENTER = 87 Global Const $MENUDROPALIGNMENT = 40 Global Const $MIDEASTENABLED = 74 Global Const $MOUSEPRESENT = 19 Global Const $MOUSEHORIZONTALWHEELPRESENT = 91 Global Const $MOUSEWHEELPRESENT = 75 Global Const $NETWORK = 63 Global Const $PENWINDOWS = 41 Global Const $REMOTECONTROL = 0x2001 Global Const $REMOTESESSION = 0x1000 Global Const $SAMEDISPLAYFORMAT = 81 Global Const $SECURE = 44 Global Const $SERVERR = 289 Global Const $SHOWSOUNDS = 70 Global Const $SHUTTINGDOWN = 0x2000 Global Const $SLOWMACHINE = 73 Global Const $STARTER = 88 Global Const $SWAPBUTTON = 23 Global Const $TABLETPC = 86 Global Const $XVIRTUALSCREEN = 76 Global Const $YVIRTUALSCREEN = 77  
      WinAPISystemMetricsConstants.au3
    • rcmaehl
      By rcmaehl
      A UDF with Extended Functions for Window Management
       
      Notes:
      Fixes WinGetClassList's barbaric returning of a @LF separated string instead of an array.
       
      Potential Uses:
      Automating applications that change their controls' handles/classes on each launch (e.g. half of Cisco's programs)
       
      Functions:
      _WinGetClassList
      _WinGetClassNNList
      _WindowGetHandleList
      _WindowGetHandleListFromPos
       
      Download: 
      WindowEx.zip  (v0.4)
       
      Changelog:
      10/04/2016 (v0.4): _WinGetClassNNList Fixed : Not Returning an Index when using $2D_ARRAY _WinGetClassNNList Fixed : Not Properly returning $aArray[x][1] on Classes with instances > 9 when using $2D_ARRAY 10/03/2016 (v0.3): _WinGetClassList Added : Exactly the same as WinGetClassList but returns a more civilized Array _WinGetClassNNList Added : Returns Classes and their instances in either a 1D or 2D array depending on Flags _WindowGetHandleList Renamed: _WinGetHandleList SCRIPT BREAKING! _WindowGetHandleListFromPos Renamed: _WinGetHandleListFromPos SCRIPT BREAKING! 10/01/2016 (v0.2): WindowsExConstants.au3 Added : Flags in _WindowGetHandleListFromPos _WindowGetHandleListFromPos Removed: ConsoleWrite left in during debug _WindowGetHandleListFromPos Added : Flag for if part of a Control is at $X, $Y return it as well. 10/01/2016 (v0.1): _WindowGetHandleList Added : Retrieves the handles of classes from a window. _WindowGetHandleListFromPos Added : Retrieves the handles of classes at a specific position from a window. Known and Reported Bugs:
      None reported To Do:
      To Be Decided. Opinions welcome! Upcoming Changes:
      To Be Decided.
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone

      I was playing a little bit with "Screen Capture" UDF, and I was trying to make a "Window" capture, but, since I made a GUI which through I fire the event "Capture", my GUI is captured as well, and I don't want to
      This is the line of code that makes the capture:
       
      _ScreenCapture_CaptureWnd($strScreenCaptureFileName, $objActiveWindow, 0, 0, -1, -1, False) And these are the lines of code which select the "active" window:
       
      Local $objCurrentWindow = 9999 If _IsPressed("01") Then $objCurrentWindow = WinGetHandle("[ACTIVE]") If $objCurrentWindow <> $objMyGUI Then $objActiveWindow = $objCurrentWindow EndIf EndIf Sorry If I made stupid mistakes
      Thanks in advance.

      Francesco
    • kcvinu
      By kcvinu
      Hi all,
      I am playing with _GUICtrlButton_Create function. How can i change this button's (or the entire form's) font ?. The in-built GUICtrlSetFont function is not working even when i convert the control handle to control ID with _WinAPI_GetDlgCtrlID ( ) function.  Do i need to use CreateFont api finction and send WM_SETFONT message ? Or is there any other easy and safe ways to do this ?. Thanks in advance.
      Note : This window is created by CreateWindowEx function, not by GUICreate function. 
    • okolaris
      By okolaris
      Hey everyone,
      I thought I might share my little Language UDF plus the more powerful SciTE Tool to ship Strings from SciTE into the xml file. While I haven't had the time to fully adapt the small UDF to one of the big XML-UDFs the so called "Language Transmitter" that basically writes the XML file for you runs mostly on "XML DOM wrapper (COM)" by eltorro. The Transmitter should work with other XML-Language-UDFs depending on their encoding.
       
      First let's start with the UDF, there are two functions of interest: _LangInit($sFilePath) and s($sString) As you will have guessed, _LangInit($sFilePath) is called once to initialize the UDF and s($sString) is used to receive the string to your key. Plain and simple.
      Now to the actual "new" part, the Language Transmitter. It basically allows you to transfer a selected String from SciTE into a xml file. While doing so it will scan for AutoIt variables, macros etc. and parse the string to fit StringFormat(). It then saves the formatted string in the xml file and returns the formatted call into SciTE. If the selected string is already defined it will directly parse the key into SciTE. To change the default output file, you can either edit the ini-file in the @ScriptDir of the LanguageTransmitter.exe or press Alt+A on empty space again and keep clicking cancel/no until the Transmitter let's you select the current output file. Standard output is strings.xml in the current opened AutoIt Script.
      Example:
      ; given the line: MsgBox(16, 'Error', 'Error message') ; select 'Error' run the Transmitter follow the instructions, repeat with 'Error message'. Outcome (e.g.): MsgBox(16, s('Error'), s('Error_msg')) ; Variables and Macro example: $sString = "Value: " & $iValue & @CRLF & 'Another value: '& $iValue2 ; Select the full string including all AutoIt variables and macros etc. in SciTE and press Alt+A (default) to run the LanguageTransmitter ; follow the instructions and it will then paste a formatted string like that into SciTE: $sVar = StringFormat(s('Key'), $iValue, $iValue2) ; the correlating xml entry should look like that: ; <string name="Key">Value: %s\r\nAnother value: %s</string> ; as you can see @CRLF has been replaced with \r\n as well. If you are working on a project and want to directly add a string to the xml file just start the Language Transmitter without selecting any text, enter your string and a key.
      SetUp/Installation
      Examples
      Since xml files are required all examples can be found in the zip file. There are two examples, one includes a language selection interface.
      Language File Checker
      I added a script to check whether the xml file contains all required strings or even unnecessary strings.
       
      Hope you like my little helper!
       
      UDF - LanguageSupport.zip
×