View Single Post
Old 10-26-2016, 06:46 AM
b_rianv b_rianv is offline
Join Date: Sep 2014
Posts: 13

Here is the working code for me...

Dim sapi,hr,ampm,wish
Set sapi = CreateObject("sapi.spvoice")
end if
end if
if(hour(now)<12)Then ampm="AM" end if 

if(hour(now)>12)Then ampm="PM" end if

select case hour(now)
case 0: hr="12"
case 1: hr="1"
case 2: hr="2"
case 3: hr="3"
case 4: hr="4"
case 5: hr="5"
case 6: hr="6"
case 7: hr="7"
case 8: hr="8"
case 9: hr="9"
case 10: hr="10"
case 11: hr="11"
case 12: hr="12"
case 13: hr="1"
case 14: hr="2"
case 15: hr="3"
case 16: hr="4"
case 17: hr="5"
case 18: hr="6"
case 19: hr="7"
case 20: hr="8"
case 21: hr="9"
case 22: hr="10"
case 23: hr="11"
end select
if(hour(now)>=0) and (hour(now)<12)Then wish="Brian,Good Morning" end if 
if(hour(now)>=12) and (hour(now)<=17)Then wish="Brian,Good Afternoon" end if
if(hour(now)>=17) and (hour(now)<=23)Then wish="Brian,Good Evening" end if 

sapi.Speak wish+". Brian, the time is "+ hr+" "+ampm
It works very good!!!

Now my other question is this.
How could I get this code to speak every 30 minutes?
Brian,Good morning
Brian,the time is 7:00 am
then 30 minutes later it would run again
Brian,Good morning
Brian,the time is 7:30 am
So on and so forth.

Thank you for your help
Reply With Quote