vbs版的语音报时程序
2016-07-09 00:00
267 查看
几年前出于兴趣写的。将以下vbs代码另存为文件,双击后即可听到语音报时。
Dim a,b,c,d,e,f,g Function FormateTime(sendTime,Para) '格式化时间 select case Para case "1" sendTime = Right("00" & Hour(sendTime),2) & ":"& right( "00" & minute(sendTime),2) & ":"& right( "00" & Second(sendTime),2) end select FormateTime = SendTime end Function Function FormateDate(sendTime,Para) '格式化日期 select case Para Rem YYYY年MM月DD日 case "1" sendTime = year(sendTime) & "年"& right( "00" & month(sendTime),2) & "月"& right( "00" & day(sendTime),2)& "日 " End select FormateDate = SendTime end Function 'MsgBox FormateDate(date(), "1") a = Left(FormateTime(Time(), "1"),2) b = "飞阳早上好,现在是," c = "飞阳上午好,现在是," d = "飞阳中午好,现在是," e = "飞阳下午好,现在是," f = "飞阳晚上好,现在是," g = ","&WeekdayName(Weekday(Date)) Set objVoice = CreateObject("SAPI.SpVoice") objVoice.Rate = -2 objVoice.Volume = 60 If a >= 0 And a <= 8 Then objVoice.Speak b&Time&g End If If a >= 9 And a <= 11 Then objVoice.Speak c&Time&g End If If a >= 12 And a <= 14 Then objVoice.Speak d&Time&g End If If a >= 15 And a <= 18 Then objVoice.Speak e&Time&g End If If a > 19 And a <= 23 Then objVoice.Speak f&Time&g End If
相关文章推荐
- VBS脚本写的Windows硬件检测工具分享
- VBS实现截图功能
- 禁止QQ上网的vbs脚本代码
- 用vbs实现cmd功能的代码
- 不错的主要用于加密的vbs(asp)位移运算类
- VBS调用Photoshop批量生成缩略图的代码
- VBS教程:对象-Err
- VBS InternetExplorer.Application的属性和方法介绍
- 用vbs实现的简单的服务器文件备份办法压缩文件名自动按日期命名
- VBS基础编程教程 (第1篇)
- VBS显示当前标准时间
- 自动切换能播放音乐列表 vbs
- VBS 两数相加取值问题分析
- VBScript 打造自己的远程CMDShell附使用教程
- VBS基础编程教程 (第3篇)
- 用vbs删除某些类型文件和磁盘空间报告的脚本
- 使用vbs删除host文件域址内容
- vbs Size 属性使用介绍(获取文件大小)
- 非常棒的lcx写的非常规运行vbs
- windows2003一句话开3389的vbs代码