标题: [问题求助] 生日提醒用VBS怎么做? [打印本页]
作者: ww0000 时间: 2013-1-14 15:42 标题: 生日提醒用VBS怎么做?
比如2013年1月15日是生日,这天一打开电脑就会出现一个生日祝福的对话框!
VBS怎么做?谢谢
作者: batman 时间: 2013-1-14 17:04
本帖最后由 batman 于 2013-1-14 17:06 编辑
运行第一次后就会每天随机启动:- On Error Resume Next
- Dim objSHELL, File, RegPath
- Set objSHELL = CreateObject("Wscript.Shell")
- File = WScript.ScriptFullName
- RegPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\AutoRun"
- objSHELL.RegRead RegPath
- If Err.Number <> 0 Then
- Err.Clear
- objSHELL.RegWrite RegPath, Chr(34) & File & Chr(34), "REG_SZ"
- End If
- Set objSHELL = Nothing
- Dim BirthDay, NowDay
- BirthDay = "2013-1-14"
- NowDay = DateValue(Now())
- If CStr(NowDay) = BirthDay Then WScript.Echo "生日快乐"
复制代码
作者: ww0000 时间: 2013-1-14 17:07
本帖最后由 ww0000 于 2013-1-14 17:09 编辑
回复 2# batman
1、为什么是 BirthDay = "2013-1-14" 我是2013-1-15
2、怎么才能到了这天每间隔十分钟提示一次,而不是随机呢?
3、怎么做到一开机就运行
4、如何才能取消它??
谢谢老师
作者: batman 时间: 2013-1-14 17:25
本帖最后由 batman 于 2013-1-14 17:30 编辑
随机启动就是开机自动运行,日期你自己改:- On Error Resume Next
- Dim objSHELL, File, RegPath
- Set objSHELL = CreateObject("Wscript.Shell")
- File = WScript.ScriptFullName
- RegPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\AutoRun"
- objSHELL.RegRead RegPath
- If Err.Number <> 0 Then
- Err.Clear
- objSHELL.RegWrite RegPath, Chr(34) & File & Chr(34), "REG_SZ"
- End If
- Dim BirthDay, NowDay
- BirthDay = "2013-1-14"
- NowDay = DateValue(Now())
- If CStr(NowDay) = BirthDay Then
- Do Until CStr(NowDay) <> BirthDay
- objSHELL.Popup "生日快乐", 5
- WScript.Sleep 1000 * 60 * 10
- Loop
- End If
- Set objSHELL = Nothing
复制代码
取消的批处理代码:- @echo off
- taskkill /f /im "wscript.exe"
- reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v AutoRun /f
复制代码
作者: ww0000 时间: 2013-1-14 18:43
回复 4# batman
批处理就是保存为BAT?
谢谢!
作者: ww0000 时间: 2013-1-15 11:40
回复 4# batman
老师,我根据你的代码改的,到了11:38:10提醒吃午饭了,为什么不行呀?
On Error Resume Next
Dim objSHELL, File, RegPath
Set objSHELL = CreateObject("Wscript.Shell")
File = WScript.ScriptFullName
RegPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\AutoRun"
objSHELL.RegRead RegPath
If Err.Number <> 0 Then
Err.Clear
objSHELL.RegWrite RegPath, Chr(34) & File & Chr(34), "REG_SZ"
End If
Dim Birthtime, Nowtime
Birthtime ="11:38:10"
Nowtime =Hour(Now)&":"&Minute(Now)&":"&Second(Now)
If CStr(Nowtime) = Birthtime Then
Do Until CStr(Nowtime) <> Birthtime
objSHELL.Popup "吃午饭了", 5
WScript.Sleep 1000 * 60 * 1
Loop
End If
Set objSHELL = Nothing
作者: ww0000 时间: 2015-4-22 14:56
回复 4# batman
老师,再请教一下,我要设置多个人的生日.如何写代码?
作者: yu2n 时间: 2015-4-22 23:26
本帖最后由 yu2n 于 2015-4-22 23:28 编辑
免费生日提醒服务:
指定公历、农历生日日期,到了生日日期发送QQ消息+邮件+短信。
见 [QQ邮箱] » [日历] » [提醒]
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |