护眼弹窗脚本

护眼弹窗小脚本:
使用方法:
复制粘贴到记事本中,点击另存为,编码格式选择ASNI,保存覆盖原文件
重命名,.txt后缀改为.vbs,双击即可运行。

set WshShell = WScript.CreateObject("WScript.Shell")

Dim worktime,alarmnum,relaxtime
Dim msg,response,mystring

style1 = vbYesNo + vbQuestion + vbDefaultButton2 '定义对话框样式
style2 = vbOKOnly + vbInformation + vbSystemModal + vbMsgBoxSetForeground

worktime = inputbox("请输入持续工作时间/min")

if isempty(worktime) then
    msgbox "取消输入,退出程序"
    WshShell.run "taskkill /f /im wscript.exe",0
else
    if worktime = "" then
        worktime = 20   '默认的持续工作时间
    else
    worktime = int(worktime)
    end if
end if

alarmnum = inputbox("请输入提醒次数")
if isempty(alarmnum) then
    msgbox "取消输入,退出程序"
    WshShell.run "taskkill /f /im wscript.exe",0
else
    if alarmnum = "" then
        alarmnum = 25   '默认的提醒次数
    else
    alarmnum = int(alarmnum)
    end if
end if

relaxtime = inputbox("请输入远眺时间/s")
if isempty(relaxtime) then
    msgbox "取消输入,退出程序"
    WshShell.run "taskkill /f /im wscript.exe",0
else
    if relaxtime = "" then
        relaxtime = 20   '默认的远眺时间
    else
    relaxtime = int(relaxtime)
    end if
end if

msg = "设置为" & worktime & "-" & alarmnum & "-" & relaxtime & vbnewline & "是否开启护眼模式"
response = msgbox(msg,style1,"护眼")

if response = vbYes then '用户按下“是”按钮
    mystring = "Yes" '进行某些操作
else '用户按下“否”按钮
    mystring = "No" '进行某些操作
end if

if mystring = "Yes" then
   ' worktime = 1   '设置的持续工作时间
   ' alarmnum = 25   '25为提醒的次数
   ' relaxtime = 20  '设置的远眺时间
    alerttitle = "已持续用眼" & worktime & "分钟!"
    '提醒内容,vbnewline为换行符
    alerttext = "远眺20s,点击确认计时开始"

    for i = 1 to alarmnum 
        WScript.Sleep(1000*60*worktime) '每20分钟提醒一次
        atext = alerttext & vbnewline & vbnewline
        msgbox atext,style2,alerttitle

            for j = relaxtime to 1 step -1
            WshShell.popup "倒计时" & j & "s",1,"远眺时间",0
            'WScript.Sleep(1000)
            next
    next
else
    WshShell.run "taskkill /f /im wscript.exe",0
end if

结束任务小脚本:

set WshShell = WScript.CreateObject("WScript.Shell")
WScript.echo "退出所有wscript.exe"
WshShell.run "taskkill /f /im wscript.exe",0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值