Asked
— Edited
@Rich.
I was looking through the forum and came across a thread where you mentioned you made a script to speak the current time. I tried it out but I'm having a problem with it. When I start the script, it only says "The time is dollar the time". Is there something that I need to change in the syntax as I know this posted a year ago and something might have changed.
IF ($hour>12)
$hour_word=$hour-12
ELSE
$hour_word=$hour
ENDIF
IF ($hour_word=0)
$hour_word=12
ENDIF
IF ($Minute = 0)
$thetime = "$hour_word"
ELSEIF ($minute = 1)
$thetime = "one minute past $hour_word"
ELSEIF ($minute = 15)
$thetime = "quarter past $hour_word"
ELSEIF ($minute = 30)
$thetime = "half past $hour_word"
ELSEIF ($minute 30)
$hour_word=$hour_word+1
$minute_word = 60-$minute
$thetime = "$minute_word minutes to $hour_word"
ELSE
$thetime = "$hour_word $minute"
ENDIF
IF ($hour 21)
$thetime = "$thetime at night"
ELSEIF ($hour > 17)
$thetime = "$thetime in the evening"
ELSEIF ($hour > 11)
$thetime = "$thetime in the afternoon"
ENDIF
Say("The time is $thetime")
Many thanks.
Just jumped on this quickly while I had a few minutes spare. it's by no means the final draft and I am certain I can improve on it (for one the IFs can use and and or to make less code) but give this a whirl.
Not fully tested but tested between 6:25 and 6:35 PM and it worked OK. I'm not entirely sure what happens at 11pm and later though but will try it out in a few hours time if I get chance.
It's a starter anyway, feel free to make it better
Nice one. Thanks Rich. I just got home so I will try it out this evening and let you know how it goes. Looking forward to 11pm (if I'm still awake).
Thinking about it, 11pm will be fine. It's when it passes 12:30 am it may give funny times, possibly, I'll have to check that ElseIf out a bit more
I just tried it out and it sounds really nice. Much more human sounding. Lol, NO chance of me being awake at 12:30. I'll be lucky if I make it to 9:30. tired tired
I personally think it's too specific. When did anyone last say "It's 17 minutes to 9"? I plan to round to 5 minute intervals for the one I will be using.
But the script shows a nice big if nest and some other functions which (hopefully) will help people get to grips with the programming