Snippets ( AutoIt Audio ): Difference between revisions

From AutoIt Wiki
Jump to navigation Jump to search
mNo edit summary
m (Edited snippets to conform to template snippet header)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__TOC__
__TOC__
[[category:Snippets]]


{{Snippet Credit Header}}
{{Snippet Credit Header}}


{{Snippet Header|UDFName=_EnableBeepSpeaker|AuthorURL=20477-mrcreator|AuthorName=MrCreatoR|ReturnToTop=1|AutoItCode=
== _EnableBeepSpeaker ==
 
{{Snippet Header
|AuthorURL=20477-mrcreator
|AuthorName=MrCreatoR
}}
 
<syntaxhighlight lang = "autoit">
; Stop internal "beep" speaker
; Stop internal "beep" speaker


Line 21: Line 29:
         Sleep($iPause)
         Sleep($iPause)
EndFunc
EndFunc
</syntaxhighlight>
[[#top | ReturnToContents]]
== _IEclickSound ==
{{Snippet Header
| AuthorURL=52303-djarlo
| AuthorName=Djarlo
}}
}}


{{Snippet Header|UDFName=_IEclickSound|AuthorURL=52303-djarlo|AuthorName=Djarlo|ReturnToTop=1|AutoItCode=
<syntaxhighlight lang = "autoit">
$click = _IEclickSound() ;<= off
$click = _IEclickSound() ;<= off
_IEclickSound($click);<== restore original state
_IEclickSound($click);<== restore original state


Func _IEclickSound($sound = "")
Func _IEclickSound($sound = "")
Line 37: Line 53:
     Return $rc
     Return $rc
EndFunc  ;==>_IEclickSound
EndFunc  ;==>_IEclickSound
</syntaxhighlight>
[[#top | ReturnToContents]]
== _TalkOBJ ==
{{Snippet Header
| AuthorURL=3581-erifash
| AuthorName=erifash
}}
}}


{{Snippet Header|UDFName=_TalkOBJ|AuthorURL=3581-erifash|AuthorName=erifash|ReturnToTop=1|AutoItCode=
<syntaxhighlight lang = "autoit">
; Voice Read Text
; Voice Read Text


Line 50: Line 75:
     $o_speech = ""
     $o_speech = ""
EndFunc ;==>_TalkOBJ()
EndFunc ;==>_TalkOBJ()
}}
</syntaxhighlight>
 
[[#top | ReturnToContents]]

Latest revision as of 19:27, 13 November 2012


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