'另一种定时提醒框
set WshShell = WScript.CreateObject("WScript.Shell")
alerttitle = "阿细工作室提提您!"
'其中vbnewline为换行符
alerttext = vbnewline & vbnewline & " 您已经使用电脑一个小时,为了健康着想,请注意休息!" & vbnewline & vbnewline & vbnewline & vbnewline & "(请移步至窗前,闭目养神,然后望下远景、活动下胳膊、脖子、腰部)"& vbnewline
for i = 1 to 8 '提醒8次
WScript.Sleep (1000*60*60) '每隔1小时提醒一次
msgbox alerttext,4096,alerttitle
'每次提示框被关闭后播放一段声响
strSoundFile = "C:\Windows\Media\Notify.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, True
next
'经过8次提醒后弹出关机菜单
Dim Shutdown
Set Shutdown=WScript.CreateObject("Shell.Application")
Shutdown.ShutdownWindows
'带有选择功能的提示框
intAnswer = Msgbox("你想删除这些文件吗?", vbYesNo, "提示")
If intAnswer = vbYes Then
Msgbox "您选择了“是”",,"测试"
Else
Msgbox "您选择了“否”",,"测试"
End If
'能隐藏启动DOS命令的选择框
Set objShell = CreateObject ("Wscript.Shell")
intAnswer = Msgbox(" 你想清除系统中的临时文件吗? ", vbYesNo, "提示")
If intAnswer = vbYes Then
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.tmp"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*._mp"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.gid"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.chk"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.old"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\recycled\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %windir%\*.bak"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %windir%\prefetch\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %windir%\temp\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/q %userprofile%\recent\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %userprofile%\Local Settings\Temporary Internet Files\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %temp%\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %userprofile%\Local Settings\Temp\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %userprofile%\recent\*.*"),0 ,TRUE
Msgbox "已经清除系统中的临时文件!", VbInformation, "提示"
Else
End If
'密码输入对话提示框
dim a,ctr
ctr=0 '设置计数器
const pass="password" '设置密码
do
if ctr=3 then
msgbox("你已经输入三次,程序将关闭!")
exit do
else
a=inputbox("请输入密码(你有三次机会):","密码输入器")
if a=pass then
msgbox "密码正确,可以打开文件夹!"
Set objShell = CreateObject ("Wscript.Shell")
objShell.Run("explorer.exe %windir%\system32"),1 ,TRUE
if err = 0 then
End If
exit do
else
ctr=ctr+1 '如果密码出错就增加一次错误认证计数
msgbox("输入错误密码,请重新输入!")
end if
end if
loop
(修改说明:已经删除在 [能隐藏启动DOS命令的选择框] 中的两条在执行后造成不便的命令)
[ Last edited by axi on 2007-4-14 at 01:30 PM ]作者: lxmxn 时间: 2007-3-13 02:09
不错,值得收藏学习,顶一个先。作者: jackyggt 时间: 2007-3-13 08:23 顶作者: axi 时间: 2007-3-13 12:49 补充:MsgBox 常数 有时在提示框中可以用其值来代替常数名
[ Last edited by axi on 2007-3-13 at 07:20 AM ]作者: jmz573515 时间: 2007-3-14 01:30 不错!作者: willsion 时间: 2007-3-14 02:03 不错,值得收藏。作者: andysky 时间: 2007-3-14 02:13 带有选择功能的提示框
intAnswer = Msgbox("你想删除这些文件吗?", vbYesNo, "提示")
If intAnswer = vbYes Then
Msgbox "您选择了“是”",,"测试"
Else
Msgbox "您选择了“否”",,"测试"
End If
'能隐藏启动DOS命令的选择框
Set objShell = CreateObject ("Wscript.Shell")
intAnswer = Msgbox(" 你想清除系统中的临时文件吗? ", vbYesNo, "提示")
If intAnswer = vbYes Then
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.tmp"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*._mp"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.log"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.gid"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.chk"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\*.old"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %systemdrive%\recycled\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %windir%\*.bak"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %windir%\prefetch\*.*"),0 ,TRUE
objShell.Run("%comspec% /c rd /s/q %windir%\temp & md %windir%\temp"),0 ,TRUE
objShell.Run("%comspec% /c del /f/q %userprofile%\cookies\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/q %userprofile%\recent\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %userprofile%\Local Settings\Temporary Internet Files\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %temp%\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %userprofile%\Local Settings\Temp\*.*"),0 ,TRUE
objShell.Run("%comspec% /c del /f/s/q %userprofile%\recent\*.*"),0 ,TRUE
End If
Msgbox "已经清除系统中的所有临时文件!", VbInformation, "提示"
这一段存为VBS为何不能用?作者: ieutk 时间: 2007-3-14 12:32 楼主,在你那个输入密码VBS中,可不可以不把密码显出来,也就是以星号显示!