Absolutely! Here's the full VBScript code:
```vbscript
Dim speaks, speech
Dim TodayDate
TodayDate = FormatDateTime(Date(), 2)
speaks="It is " & Hour(Time()) & " " & Minute(Time()) & " on " & WeekdayName(Weekday(Date())) & ", " & MonthName(Month(Date())) & " " & TodayDate
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks
```
Just copy and paste this script into your editor or file, and you're all set!
****
You're right. In natural English, we usually say the date before the time. Here's a more natural version of your script:
```vbscript
Dim speaks, speech
Dim TodayDate
TodayDate = FormatDateTime(Date(), 2)
speaks="Today is " & WeekdayName(Weekday(Date())) & ", " & MonthName(Month(Date())) & " " & TodayDate & ". The time is " & Hour(Time()) & ":" & Right("0" & Minute(Time()), 2)
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks
```
Now, the system will say, for example: "Today is Wednesday, March 15, 2023. The time is 14:05."
Note the use of `Right("0" & Minute(Time()), 2)` to ensure the minute always has two digits. It will add a leading zero if needed.
*****
I'm afraid I can't directly manipulate a computer's system sounds or scheduled tasks as an AI text-based model. However, I can write a sample VBScript to provide you a possible format it could take. That would help you to run it on your own computer to chime as you have described. Here it is:
```VBScript
Set oShell = CreateObject("WScript.Shell")
While True
waitTime = DateDiff("s", Now, DateAdd("n", 15 - Minute(Now), DateSerial(Year(Now), Month(Now), Day(Now))))
If waitTime <= 900 And waitTime > 750 then '15 mins
For i = 1 To 1
oShell.Run "%windir%\Media\chimes.wav", 0, True
WScript.Sleep 500 'wait half a second before the next chime
Next
ElseIf waitTime <= 1800 And waitTime > 1650 Then '30 mins
For i = 1 To 2
oShell.Run "%windir%\Media\chimes.wav", 0, True
WScript.Sleep 500 'wait half a second before the next chime
Next
ElseIf waitTime <= 2700 And waitTime > 2550 Then '45 mins
For i = 1 To 3
oShell.Run "%windir%\Media\chimes.wav", 0, True
WScript.Sleep 500 'wait half a second before the next chime
Next
ElseIf waitTime <= 3600 And waitTime > 3450 Then '60 mins
For i = 1 To 4
oShell.Run "%windir%\Media\chimes.wav", 0, True
WScript.Sleep 500 'wait half a second before the next chime
Next
End If
WScript.Sleep 60000 'wait a minute before checking the time again
Wend
```
The above script repeatedly checks the time, and plays a chime sound based on whether the current time is 15, 30, 45 or 60 minutes into the current hour.
Please note that you need to replace `%windir%\Media\chimes.wav` with the correct path to the chime sound file on your machine, and this script continuously runs on your machine until you stop it manually.
In addition, the script above will cause a brief "command prompt" window to flash on your screen every time it plays a sound. If you find this disruptive, you might want to consider using a different scripting language or mechanism for this task.
'윈도우즈' 카테고리의 다른 글
| Bus family (0) | 2023.09.19 |
|---|---|
| Help (1) | 2023.09.16 |
| Confirm (0) | 2023.09.13 |
| Cars or a car (0) | 2023.09.09 |
| Diabetes (0) | 2023.09.07 |
댓글