Roger Posted March 4, 2005 Posted March 4, 2005 (edited) I have modified a few scripts using code from Xenogis and El-Trucha. Thanks guys for posting your code for everyone to use. This script uses microsoft SDK 5.1 included with Windows XP. You must download this SDK from Microsoft website in order to use this script in any operating system below XP. There are two pieces to this program. The first is the AutoIT script and the second part is a vb script: expandcollapse popupGlobal $hour Global $pa Global $Hours HotKeySet ("^h", "_SpeakTime") Func _SpeakTime() If @hour > 12 Then $hour = @hour - 12 $pa = " P M" ElseIf @HOUR = 12 Then $hour = 12 $pa = "P M" ElseIf @HOUR = 00 Then $hour = 12 $pa = " A M" ElseIf @Hour < 10 Then $hour = @hour $hour = StringRight ($hour, 1) $pa = " A M" Else $hour = @HOUR $pa = " A M" EndIf If @MIN = 00 Then Run ("wscript.exe c:\talk.vbs " & '"Its' & $hour & " " & $pa & '"') EndIf If @MIN < 10 and @MIN <> 00 Then Run ("wscript.exe c:\talk.vbs " & '"Its' & $hour & " " & "o " & @MIN & $pa & '"') EndIf If @MIN >= 10 Then Run ("wscript.exe c:\talk.vbs " & '"Its' & $hour & " " & @MIN & $pa & '"') EndIf EndFunc() Func _CalcTime() $Hours = @HOUR + 1 If $Hours > 23 Then $Hours = 00 EndIf EndFunc() _CalcTime() While 1 If $Hours = @Hour Then If @hour > 12 Then $hour = @hour - 12 $pa = " P M" ElseIf @HOUR = 12 Then $hour = 12 $pa = "P M" ElseIf @HOUR = 00 Then $hour = 12 $pa = " A M" ElseIf @Hour < 10 Then $hour = @hour $hour = StringRight ($hour, 1) $pa = " A M" Else $hour = @HOUR $pa = " A M" EndIf Run ("wscript.exe c:\talk.vbs " & '"Its' & $hour & " " & $pa & '"') _CalcTime() EndIf Sleep (50) WEnd VBS Script ' Declaring variable to hold SAPI object. Dim voic Set objArgs = Wscript.Arguments ' Creating SAPI object using spvoice. Set voic = wscript.CreateObject("SAPI.SpVoice") ' If you want to change the voice then uncomment any of the following 3 lines. 'Set voic.voice = voic.GetVoices("Name=crystal16", "Language=409").Item(0) 'Set voic.voice = voic.GetVoices("Name=Microsoft mike", "Language=409").Item(0) 'Set voic.voice = voic.GetVoices("Name=Microsoft sam", "Language=409").Item(0) ' you can set other parameters and properties like voice pitch, speed etc. ' Using speak function of SpVoice to speak a string. voic.Speak(objArgs(0)) ' Destroying SAPI.spvoice object. Set voic = nothing Note that uncommenting the lines for the voices will change the voice that the script calls for. You must have ATT Natural voices in order to use Crystal16 or Mike16. The other voices may not be on your system. You may only have SAM. You can download the other voices off of Microsoft's website for free. I am open to comments and suggestions. I haven't been playing with AutoIT very long so go easy on me. :-) I do plan on updating the script to include GUI to add alarms and such. Forgot to mentaion that pressing ctrl plus h will announce current time in case anyone misses this. Edited March 4, 2005 by Roger
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now