Diana (Cda) Posted February 19, 2008 Share Posted February 19, 2008 (edited) #include <Date.au3> $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("It's") Sleep(50) $oSp.Speak(@MON & @MDAY & @YEAR) Sleep(50) $oSp.Speak(@HOUR & @MIN & "a.m.")I tried all sorts of combinations for the date and time syntax for this script that will run in a.m., but I just get a number-style of readout and nothing like this: "It's Tuesday, February 19, 2008, nine-thirty a.m.". I've looked through the "Macros" entry in the help file but I couldn't find any macro syntax that would give the long form of readout that's needed instead of the number one. Is there anything that will do what's needed rather than the above number style? Thanks! Edited March 17, 2008 by Diana (Cda) Link to comment Share on other sites More sharing options...
ReaImDown Posted February 19, 2008 Share Posted February 19, 2008 (edited) #include <Date.au3> $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("It's") Sleep(50) $oSp.Speak(@MON & @MDAY & @YEAR) Sleep(50) $oSp.Speak(@HOUR & @MIN & "a.m.")I tried all sorts of combinations for the date and time syntax for this script that will run in a.m., but I just get a number-style of readout and nothing like this: "It's Tuesday, February 19, 2008, nine-thirty a.m.". I've looked through the "Macros" entry in the help file but I couldn't find any macro syntax that would give the long form of readout that's needed instead of the number one. Is there anything that will do what's needed rather than the above number style? Thanks! hah I am having fun with this now $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("Today's date is " & @MON & " " & @MDAY & " " & @YEAR) if @Hour >=12 then $oSp.Speak("The time is " & @HOUR & " " & @MIN & "P M") Else $oSp.Speak("The time is " & @HOUR & " " & @MIN & "a m") EndIf Converted for 12 hour clock $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("Today's date is " & @MON & " " & @MDAY & " " & @YEAR) if @Hour >= 12 then if @Hour >= 13 Then $oSp.Speak("The time is " & @HOUR-12 & " " & @MIN & "P M") Else $oSp.Speak("The time is " & @HOUR & " " & @MIN & "P M") EndIf Else $oSp.Speak("The time is " & @HOUR & " " & @MIN & "A M") EndIf Edited February 19, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
ReaImDown Posted February 19, 2008 Share Posted February 19, 2008 (edited) sorry, I just read the title if @mon = 1 then $Mon = "January elseif @Moh = 2 then $Mon = "February" ..........ETC Endif then make it read $Month instead of @Mon Edited February 19, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 (edited) sorry, I just read the title if @mon = 1 then $Mon = "January elseif @Moh = 2 then $Mon = "February" ..........ETC Endif then make it read $Month instead of @MonBetter yet $m_Array = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|") $d_Array = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|") $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("It's") Sleep(50) $oSp.Speak($m_Array(@MON) & $d_Array(@MDAY) & @YEAR) Sleep(50) $oSp.Speak(@HOUR & @MIN & "a.m.") Edit: Watch for line wrap in $m_Array Edited February 19, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
weaponx Posted February 19, 2008 Share Posted February 19, 2008 GeoSoft - You don't even need that first array: _DateToMonth(@MON, 0) Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 GeoSoft - You don't even need that first array:_DateToMonth(@MON, 0)What I really don't need is to #include Date.au3. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Diana (Cda) Posted February 19, 2008 Author Share Posted February 19, 2008 $m_Array = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|") $d_Array = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|") $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("It's") Sleep(50) $oSp.Speak($m_Array(@MON) & $d_Array(@MDAY) & @YEAR) Sleep(50) $oSp.Speak(@HOUR & @MIN & "a.m.")Edit: Watch for line wrap in $m_ArrayNo problems with word-wrap. I get an error, though, right under the "$" right at the beginning, like so:$oSp.Speak($m_Array(@MON) ... $oSp.Speak(^ ERROR Error: Error in expression. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted February 19, 2008 Author Share Posted February 19, 2008 GeoSoft - You don't even need that first array:_DateToMonth(@MON, 0)Since I get an error with regards to the first array, how would you incorporate this into the above code, pls?Thanx. :0 Link to comment Share on other sites More sharing options...
weaponx Posted February 19, 2008 Share Posted February 19, 2008 Change this line: $oSp.Speak($m_Array(@MON) & $d_Array(@MDAY) & @YEAR) to $oSp.Speak($m_Array[@MON] & $d_Array[@MDAY] & @YEAR) Link to comment Share on other sites More sharing options...
Developers Jos Posted February 19, 2008 Developers Share Posted February 19, 2008 No problems with word-wrap. I get an error, though, right under the "$" right at the beginning, like so:$oSp.Speak($m_Array(@MON) ... $oSp.Speak(^ ERROR Error: Error in expression.Arrays use squared bracket like : $m_Array[@MON]. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 Arrays use squared bracket like : $m_Array[@MON]. Jos xxxxxxxxxxxxxxx George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Developers Jos Posted February 19, 2008 Developers Share Posted February 19, 2008 xxxxxxxxxxxxxxx You can skip the kisses ... I am not into male bonding SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
weaponx Posted February 19, 2008 Share Posted February 19, 2008 You can skip the kisses ... I am not into male bonding Won't be GEOSoft much longer! Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 Won't be GEOSoft much longer! Don't go there. Jos already did enough. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Gigglestick Posted February 19, 2008 Share Posted February 19, 2008 $objSp = ObjCreate("SAPI.SpVoice") $arrMonth = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|") $arrDay = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|") $arrHour = StringSplit("1|2|3|4|5|6|7|8|9|ten|eleven|twelve", "|") $intHour = @HOUR $intMin = @MIN $strHour = "" $strMin = "" $strAMPM = "" If $intHour > 12 Then $strAMPM = "PM" $strHour = $intHour - 12 Else $strAMPM = "AM" $strHour = $intHour EndIf If $intMin > 9 Then $strMin = $intMin Else $strMin = "o " & $intMin; An O, not a zero (i.e. "twelve oh eight pm") EndIf $strSpeech = "It's, " & $arrDay[@WDAY] & ", " & $arrMonth[@MON] & ", " & @MDAY & ", " & @YEAR & ", at " & $strHour & " " & $strMin & " " & $strAMPM $objSp.Speak($strSpeech) Putting a comma in the speech will insert the delay you're trying to achieve. My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
GEOSoft Posted February 19, 2008 Share Posted February 19, 2008 $objSp = ObjCreate("SAPI.SpVoice") $arrMonth = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|") $arrDay = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|") $arrHour = StringSplit("1|2|3|4|5|6|7|8|9|ten|eleven|twelve", "|") $intHour = @HOUR $intMin = @MIN $strHour = "" $strMin = "" $strAMPM = "" If $intHour > 12 Then $strAMPM = "PM" $strHour = $intHour - 12 Else $strAMPM = "AM" $strHour = $intHour EndIf If $intMin > 9 Then $strMin = $intMin Else $strMin = "o " & $intMin; An O, not a zero (i.e. "twelve oh eight pm") EndIf $strSpeech = "It's, " & $arrDay[@WDAY] & ", " & $arrMonth[@MON] & ", " & @MDAY & ", " & @YEAR & ", at " & $strHour & " " & $strMin & " " & $strAMPM $objSp.Speak($strSpeech) Putting a comma in the speech will insert the delay you're trying to achieve.I forgot how to set the pause in SAPI. I know there is a Pause command for Agent Character speech but I couldn't find the same thing for SAPI. Thanks George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Diana (Cda) Posted February 20, 2008 Author Share Posted February 20, 2008 (edited) Change this line: $oSp.Speak($m_Array(@MON) & $d_Array(@MDAY) & @YEAR) to $oSp.Speak($m_Array[@MON] & $d_Array[@MDAY] & @YEAR)Changed to:$m_Array = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|") $d_Array = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|") $oSp = ObjCreate("SAPI.SpVoice") $oSp.Speak("It's") Sleep(50) $oSp.Speak($m_Array[@MON] & $d_Array[@MDAY] & @YEAR) Sleep(50) $oSp.Speak(@HOUR & @MIN & "a.m.")This is neat; I'm learning all sorts of AI errors I never knew about <lol>. Now I get this one, whatever the heck it means! ----------------------- $oSp.Speak($m_Array[@MON] & $d_Array[@MDAY] & @YEAR) $oSp.Speak($m_Array[@MON] & ^ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. ----------------------- Thanks. Edited February 20, 2008 by Diana (Cda) Link to comment Share on other sites More sharing options...
Diana (Cda) Posted February 20, 2008 Author Share Posted February 20, 2008 $objSp = ObjCreate("SAPI.SpVoice") $arrMonth = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|") $arrDay = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|") $arrHour = StringSplit("1|2|3|4|5|6|7|8|9|ten|eleven|twelve", "|") $intHour = @HOUR $intMin = @MIN $strHour = "" $strMin = "" $strAMPM = "" If $intHour > 12 Then $strAMPM = "PM" $strHour = $intHour - 12 Else $strAMPM = "AM" $strHour = $intHour EndIf If $intMin > 9 Then $strMin = $intMin Else $strMin = "o " & $intMin; An O, not a zero (i.e. "twelve oh eight pm") EndIf $strSpeech = "It's, " & $arrDay[@WDAY] & ", " & $arrMonth[@MON] & ", " & @MDAY & ", " & @YEAR & ", at " & $strHour & " " & $strMin & " " & $strAMPM $objSp.Speak($strSpeech) Putting a comma in the speech will insert the delay you're trying to achieve.Ah, neat. Sometimes that works and sometimes it doesn't in some apps. That's a neat replacement for the Sleep() code I had, for sure. I stumbled upon using punctuation as a pause effect in my tts reminder/scheduler freeware called PUAC though the commas and other punctuation stopped working in XP as a means to pause between words (lots of stuff no longer works in XP <g>). Anywho, this is great. I only needed an a.m. script but this is much better. I probably can just block out the p.m. script for the current need using ";", I'm guessing. Will try that for this current a.m. need. There's only one little thing left re easily understanding spoken time. I need the 24-hour clock format so that must stay. Even my wrist watch is set to display in that format, esp. since all the posted bus schedules around town display in 24-hour mode so I got into the 24-hour habit nearly 20 years ago. The only difficulty with it is the leading zero. It's kind of weird having to stop for a half moment to translate "zero six forty-six a.m." to just plain "six forty-six a.m.". One last request although you've done so much already, is there a way to get it to not read those zeros? I have an excellent talking time freeware, but it doesn't read off the date and the highest frequency it can be set to run is every 15 minutes. This script would be an incredible workaround where I get the best of both worlds. I'll put code in it to have it repeat every 5 minutes during critical period in morning (hey, I know how to do that now!! <g>). Thanks. Link to comment Share on other sites More sharing options...
GEOSoft Posted February 20, 2008 Share Posted February 20, 2008 (edited) Ah, neat. Sometimes that works and sometimes it doesn't in some apps. That's a neat replacement for the Sleep() code I had, for sure. I stumbled upon using punctuation as a pause effect in my tts reminder/scheduler freeware called PUAC though the commas and other punctuation stopped working in XP as a means to pause between words (lots of stuff no longer works in XP <g>). Anywho, this is great. I only needed an a.m. script but this is much better. I probably can just block out the p.m. script for the current need using ";", I'm guessing. Will try that for this current a.m. need. There's only one little thing left re easily understanding spoken time. I need the 24-hour clock format so that must stay. Even my wrist watch is set to display in that format, esp. since all the posted bus schedules around town display in 24-hour mode so I got into the 24-hour habit nearly 20 years ago. The only difficulty with it is the leading zero. It's kind of weird having to stop for a half moment to translate "zero six forty-six a.m." to just plain "six forty-six a.m.". One last request although you've done so much already, is there a way to get it to not read those zeros? I have an excellent talking time freeware, but it doesn't read off the date and the highest frequency it can be set to run is every 15 minutes. This script would be an incredible workaround where I get the best of both worlds. I'll put code in it to have it repeat every 5 minutes during critical period in morning (hey, I know how to do that now!! <g>). Thanks. Change this line $strSpeech = "It's, " & $arrDay[@WDAY] & ", " & $arrMonth[@MON] & ", " & @MDAY & ", " & @YEAR & ", at " & $strHour & " " & $strMin & " " & $strAMPMto If @HOUR = 0 Then $sHour = "zero" Else $sHour = $arrHour[@Hour] EndIf $strSpeech = "It's, " & $arrDay[@WDAY] & ", " & $arrMonth[@MON] & ", " & @MDAY & ", " & @YEAR & ", at " & $sHour & " " & $strMin replace $arrHour = StringSplit("1|2|3|4|5|6|7|8|9|ten|eleven|twelve", "|") with $arrHour = StringSplit("1|2|3|4|5|6|7|8|9|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|ninete en|twenty|twenty one|twenty two|twenty three", "|") and change the following $intHour = @HOUR $intMin = @MIN $strHour = "" $strMin = "" $strAMPM = "" If $intHour > 12 Then $strAMPM = "PM" $strHour = $intHour - 12 Else $strAMPM = "AM" $strHour = $intHour EndIf If $intMin > 9 Then $strMin = $intMin Else $strMin = "o " & $intMin; An O, not a zero (i.e. "twelve oh eight pm") EndIf to $intMin = @MIN If $intMin > 9 Then $strMin = $intMin Else $strMin = "o " & $intMin; An O, not a zero (i.e. "twelve oh eight pm") EndIf Edit: Again watch for line wrap Edited February 20, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
SandelPerieanu Posted February 20, 2008 Share Posted February 20, 2008 (edited) this code... it's ok for you? #include<Date.au3> $objsp = ObjCreate("SAPI.SpVoice") $hour = @HOUR - 0 $min = @MIN - 0 $strampm = "AM" If $hour >= 12 Then $strampm = "PM" If $hour > 12 Then $hour -= 12 If $hour = 0 Then $hour += 12 If $min < 10 Then $min = "o " & $min $strspeech = "It's, " & _DateDayOfWeek(@WDAY, 0) & ", " & _DateToMonth(@MON, 0) & ", " & @MDAY & ", " & @YEAR & ", at " & $hour & " " & $min & " " & $strampm ConsoleWrite($strspeech & @CRLF) $objsp.Speak($strspeech) Edited February 20, 2008 by psandu.ro Link to comment Share on other sites More sharing options...
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