|
junyee
中级用户
  
积分 253
发帖 112
注册 2006-5-31
状态 离线
|
『楼 主』:
规定时间后弹出提示
使用 LLM 解释/回答一下
我想写个东东,以实现如下效果
运行后/
要求输入一个时间(a,单位:小时),
输入后,弹出窗口“你所设定的上机时间为a小时!“
3秒后该弹出窗口自己隐藏!
每15分钟弹出一个提示:保护眼睛哦!15秒后提示框消失~
然后在刚才输入的时间(a)快要到达(如输入的是1,则在59分钟)的时候,提示"你所限定的时间已到!请做好下机准备!"(最好,能在此同时显示倒计时!60-59-58...1-0)
倒计时为0(也就是所输入的时间a到达)的时候,运行某个程序!
用vbs应该能实现吧?可我不懂,连bat 也只是略懂一二~,如果能用bat写的话,就更好了^_^~~
我在本论坛里也发过帖求助,可是得到的回答不甚多哉~唉。
最好,不要通过第三方软件~~我在网上搜了好多回了,都很少有能真正满意的。我想实现的,是让谁都会用!
做这个东西的目的呢,很明显,是能对某些电脑频繁使用者做出提醒!关注自身健康!
本人就是因为不注意用眼的相关问题,长时间面对显示器,导致了现在的高度近视!
可悔之无及矣!只能盼望某位高人,能写出这样一个东西.
把这个东西放在网吧里,使(或督促)每位上机用户都能养成良好的用眼习惯!
祝每位电脑爱好者,在享受电脑带给我们欢乐的同时,能一直拥有一双明亮的眼睛!
圣诞快乐~~~~~~
乞盼!
I want to write something to achieve the following effects
After running /
Requires entering a time (a, unit: hours),
After entering, a pop-up window "The online time you set is a hours!" pops up
This pop-up window hides by itself after 3 seconds!
A prompt pops up every 15 minutes: Protect your eyes! The prompt box disappears after 15 seconds~
Then when the time (a) you just entered is about to reach (for example, if you enter 1, it is at 59 minutes), prompt "The time you limited has arrived! Please be ready to log off!" (Preferably, a countdown can be displayed at the same time! 60-59-58...1-0)
When the countdown is 0 (that is, the entered time a arrives), run a certain program!
It should be achievable with vbs? But I don't understand, and I only have a slight understanding of bat~ If it can be written with bat, it would be better^_^~~
I also posted a request in this forum, but the answers received are not many~ Alas.
Preferably, no third-party software is used~~ I have searched online many times, and there are few that can really satisfy. I want to implement something that everyone can use!
The purpose of making this thing is obvious, which is to remind some people who use the computer frequently! Pay attention to their own health!
I myself have caused high myopia now because I didn't pay attention to eye-related issues and faced the monitor for a long time!
It's too late to regret! I can only hope that a certain expert can write such a thing.
Put this thing in the Internet cafe, so that (or urge) each online user can develop a good eye care habit!
Wish every computer enthusiast, while enjoying the joy brought by the computer, can always have a pair of bright eyes!
Merry Christmas~~~~~~
Hoping!
|
|
2006-12-25 11:32 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
作了个批,代码有点乱!!但还行!!!我时间不多没测到一小时!!!你自己测试一下!!!!
第一次沙发!!呵呵!!!
@echo off
set /p a=你所设定的上机时间为a小时:
set /a b=%a%
set /a d=%a%*4
set /a d=%d%-1
msg %username% /time:3 "你所设定的上机时间为%a%小时!"
set /a c=1
set /a e=15
setlocal enabledelayedexpansion
:1
sleep 900000
msg %username% /time:15 ":)........保护眼睛哦........:)!"
if !e! equ 14 goto 3
if !c! equ !d! set /a e=14
set /a c+=1&&goto 1
:3
sleep 840000
set f=60
:4
msg %username% /time:1 ":)还有!f!秒时间到!请作好备份!!!:)"
set /a f-=1
if !f! GEQ 1 goto 4
sleep 60000
exit
sleep这个软件时间准(毫秒级别)!!内存占用不多!!!(388k)
一个小缺点一定要是整数小时!!!
sleep一定要和批放在一个文件夹中,否则代码中的sleep要改为具体路径!!如d:\sleep.exe
更正了几个严重错误!!
楼主需要的话,把exit改为你要运行的程序就可以了!!!
Last edited by lotus516 on 2006-12-25 at 03:47 PM ]
I made a batch, the code is a bit messy!! But it's okay!!! I don't have much time and didn't test it for an hour!!! You test it yourself!!!!
First sofa!! Hehe!!!
@echo off
set /p a=The time you set for using the computer is a hours:
set /a b=%a%
set /a d=%a%*4
set /a d=%d%-1
msg %username% /time:3 "The time you set for using the computer is %a% hours!"
set /a c=1
set /a e=15
setlocal enabledelayedexpansion
:1
sleep 900000
msg %username% /time:15 ":)........Protect your eyes........:)"
if !e! equ 14 goto 3
if !c! equ !d! set /a e=14
set /a c+=1&&goto 1
:3
sleep 840000
set f=60
:4
msg %username% /time:1 ":)There are still !f! seconds until the time is up! Please make a backup!!!:)"
set /a f-=1
if !f! GEQ 1 goto 4
sleep 60000
exit
The sleep software has accurate time (millisecond level)!! The memory usage is not much!!! (388k)
A small drawback must be an integer hour!!!
The sleep must be in the same folder as the batch, otherwise the sleep in the code should be changed to the specific path!! Such as d:\sleep.exe
Corrected a few serious errors!!
If the owner needs it, change exit to the program you want to run!!!
Last edited by lotus516 on 2006-12-25 at 03:47 PM ]
|
|
2006-12-25 13:51 |
|
|
win2ye
初级用户
 
积分 58
发帖 22
注册 2005-12-15
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
学习中
还是要外部命令
不过想让BAT利用内部命令达到效果,难!
Learning
Still need external commands
But it's difficult to make BAT use internal commands to achieve the effect!
|
|
2006-12-25 22:15 |
|
|
jmz573515
银牌会员
    
积分 1212
发帖 464
注册 2006-12-13
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
我想是不是可以调用一下shutdown这个命令.
I think maybe I can call the shutdown command.
|
|
2006-12-25 22:39 |
|
|
vlanmaster
初级用户
 
积分 100
发帖 46
注册 2006-12-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
不过shutdown好象必须有administrator权限.不然没法执行.
But shutdown seems to require administrator privileges. Otherwise, it can't be executed.
|
|
2006-12-25 23:27 |
|
|
voiL
中级用户
  
积分 384
发帖 189
注册 2005-10-19
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
不是管理员的话可能有点难度...
还有,楼主的运行环境是??????........
It might be a bit difficult if you're not an administrator...
Also, what is the operating environment of the original poster??????........
|
|
2006-12-25 23:47 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
计时可以用特殊一点的方法来做到吗
灵活使用ping -w [ms] -n 1 不存在的IP
例如ping -n 1 -w 1000 1.255
Can timing be done in a special way?
Flexibly use ping -w -n 1 non - existent IP
For example, ping -n 1 -w 1000 1.255
|
|
2006-12-25 23:54 |
|
|
lcazhj
初级用户
 
积分 51
发帖 20
注册 2006-12-7
状态 离线
|
|
2006-12-26 00:21 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
|
2006-12-26 07:17 |
|
|
junyee
中级用户
  
积分 253
发帖 112
注册 2006-5-31
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
运行失败!
提示:获取会话名称时的错误 1702
这是我运行时出现的问题。。。
windows xp sp2
还有,能不能写个vbs以实现如上功能。
lotus516兄的代码没能测试成功,不知道运行后任务栏会不会有命令提示符的窗口??
我想最好写出的代码运行后不会在任务栏出现任何东西的~~vbs应该能达到吧?
Operation failed!
Prompt: Error 1702 when getting the session name
This is the problem I encountered when running...
windows xp sp2
Also, can you write a vbs to achieve the above function.
Brother lotus516's code didn't test successfully. I don't know if there will be a command prompt window in the taskbar after running??
I think the best code written should not have any things appear in the taskbar after running~~vbs should be able to achieve that, right?
|
|
2006-12-26 08:13 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by junyee at 2006-12-26 08:13:
运行失败!
提示:获取会话名称时的错误 1702
这是我运行时出现的问题。。。
windows xp sp2
还有,能不能写个vbs以实现如上功能。
lotus516兄的 ...
我还不是SP2就可以啊!!任务栏有窗口,不要窗口VBS可以作到,但我就弄不出来窗口了!!还有可以把它弄成服务就没窗口了!
Last edited by lotus516 on 2006-12-26 at 09:35 AM ]
Originally posted by junyee at 2006-12-26 08:13:
Run failed!
Prompt: Error 1702 when getting session name
This is the problem I encountered when running...
Windows XP SP2
Also, can a VBS be written to achieve the above function.
Brother lotus516's ...
I can do it without SP2! There are windows in the taskbar, but VBS can't make windows. But I just can't figure out how to make the window! Also, it can be made into a service to eliminate the window!
Last edited by lotus516 on 2006-12-26 at 09:35 AM ]
|
|
2006-12-26 09:28 |
|
|
junyee
中级用户
  
积分 253
发帖 112
注册 2006-5-31
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
,先谢下了。。。
坛里有好多VBS高手的~~~来帮一下啊?
, thank you in advance...
There are many VBS experts in the forum~~~Come and help!
|
|
2006-12-26 10:34 |
|
|
jmz573515
银牌会员
    
积分 1212
发帖 464
注册 2006-12-13
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
'大致写了一个,没有经过测试。仅供参考。(时间不能达到你说的那么准确,有些功能无法实现)
set ws=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
a=inputbox("请设定你的上机时间。(单位:小时)","提示")
ws.popup "你设定的时间为" & a& "小时",3,"提示"
starttime=timer
do
endtime=timer
sysj=endtime-starttime
if sysj>=3600*a-60 then
ws.popup"你所限定的时间已到!请做好下机准备!",60,"提示"
ws.run "cmd" '这是你要运行的程序
wscript.quit
end if
if sysj <3600*a-960 then
wscript.sleep 1000*15*60
ws.Popup"保护眼睛啊!", 15, "系统提示"
else
wscript.sleep 1000
end if
loop
Last edited by jmz573515 on 2006-12-26 at 09:49 AM ]
Roughly written one, not tested. For reference only. (The time cannot be as accurate as you said, some functions cannot be realized)
set ws=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
a=inputbox("Please set your computer time. (Unit: hours)","Prompt")
ws.popup "The time you set is " & a& " hours",3,"Prompt"
starttime=timer
do
endtime=timer
sysj=endtime-starttime
if sysj>=3600*a-60 then
ws.popup"Your limited time is up! Please be ready to log off!",60,"Prompt"
ws.run "cmd" 'This is the program you want to run
wscript.quit
end if
if sysj <3600*a-960 then
wscript.sleep 1000*15*60
ws.Popup"Protect your eyes!", 15, "System Prompt"
else
wscript.sleep 1000
end if
loop
Last edited by jmz573515 on 2006-12-26 at 09:49 AM ]
|
|
2006-12-26 12:03 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
用at命令
c:\>at /?
AT 命令安排在特定日期和时间运行命令和程序。
要使用 AT 命令,计划服务必须已在运行中。
Using the at command
c:\>at /?
The AT command schedules commands and programs to run at a specific date and time.
To use the AT command, the Schedule Service must be running.
|
|
2007-2-12 14:36 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
13楼的vbs,在第16分弹出提示,测试可以
但最后的时间到的提示没有实现?
The VBScript on floor 13 pops up a prompt at the 16th minute, and the test is okay. But the prompt when the final time is up is not implemented?
|
|
2007-2-12 22:13 |
|