Snippets ( AutoIt Audio )

From AutoIt Wiki
Jump to navigation Jump to search

Please always credit an author in your script if you use their code. It is only polite.


_EnableBeepSpeaker

Author: MrCreatoR








; Stop internal "beep" speaker

_EnableBeepSpeaker(0)
Beep(200, 600)

_EnableBeepSpeaker(1)
Beep(500, 300)

Func _EnableBeepSpeaker($iFlag=0, $iPause=500)
    Switch $iFlag
        Case 0
            Run(@ComSpec & ' /c net stop beep & sc config beep start= disabled', '', @SW_HIDE)
        Case Else
            Run(@ComSpec & ' /c sc config beep start= system & net start beep', '', @SW_HIDE)
    EndSwitch
        Sleep($iPause)
EndFunc

ReturnToContents

_IEclickSound

Author: Djarlo








$click = _IEclickSound() ;<= off
_IEclickSound($click);<== restore original state

Func _IEclickSound($sound = "")
    If $sound <> "" Then
        If Not FileExists($sound) Then Return SetError(1, 0, 0)
    EndIf
    Local $rc = RegRead("HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating\.Current", "")
    If @error Then Return SetError(2, 0, 0)
    RegWrite("HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating\.Current", "", "REG_EXPAND_SZ", $sound)
    Return $rc
EndFunc   ;==>_IEclickSound

ReturnToContents

_TalkOBJ

Author: erifash








; Voice Read Text

_TalkOBJ("Speak this line of text Please") ; change the text to suit

Func _TalkOBJ($s_text)
    Local $o_speech
    $o_speech = ObjCreate("SAPI.SpVoice")
    $o_speech.Speak ($s_text)
    $o_speech = ""
EndFunc ;==>_TalkOBJ()

ReturnToContents