On Error Resume Next
Dim Speech
Dim FSO
CreateObjects
Main
DestroyObjects
Quit
Dim objNetwork
Sub Main
Set objNetwork = CreateObject("WScript.Network")
SpeakText "This time for shutdown "+ objNetwork.UserName
End Sub
Sub SpeakText(sText)
On Error Resume Next
Speech.Speak sText, SVSFlagsAsync + SVSFPurgeBeforeSpeak
Do
Sleep 100
Loop Until Speech.WaitUntilDone(10)
End Sub
Sub StopSpeaking()
On Error Resume Next
Speech.Speak vbNullString, SVSFPurgeBeforeSpeak
Set Speech = Nothing
End Sub
Sub CreateObjects
Set Speech = CreateObject("SAPI.SpVoice")
Set FSO = CreateObject("Scripting.FileSystemObject")
End Sub
Sub DestroyObjects
Set Speech = Nothing
Set FSO = Nothing
End Sub
Sub Sleep(nTimeout)
WScript.Sleep nTimeout
End Sub
Sub Quit
WScript.Quit
End Sub
#bisa digabung dengan sample vbs lainnya. selamat berekpresi :D
0 komentar:
Posting Komentar