欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

用vbs脚本简易实现 番茄工作法

程序员文章站 2022-08-28 23:21:58
番茄工作法: 专注于某一段时间,减少打断,提高时间的感知和掌控。 25min工作+5min休息 周期:4x(25+5)+20 VBS代码实现如下: 为适应强迫症增加vds定时器调用如下: ......

番茄工作法:

专注于某一段时间,减少打断,提高时间的感知和掌控。

25min工作+5min休息

 

周期:4x(25+5)+20

 vbs代码实现如下:

 1 dim fso,f,count,time,shell
 2 set fso=wscript.createobject("scripting.filesystemobject")
 3 set f=fso.opentextfile("d:\test.txt",8,true)
 4 set shell = createobject("shell.application")
 5 count = 1
 6 for j = 1 to 3
 7 for i = 1 to 4
 8 time = now
 9 shell.toggledesktop
10 createobject("sapi.spvoice").speak  "开始持续25分钟集中注意力"
11 msgbox "hello,start focusing in 25 minutes"
12 f.write("number of tasks started: ")
13 f.writeline(count)
14 f.writeline("start focusing in 25 minutes at ")
15 f.writeline(time)
16 wscript.sleep 1000*60*25
17 time = now
18 shell.toggledesktop
19 createobject("sapi.spvoice").speak  "集中注意力时间结束,开始持续5分钟休息"
20 msgbox "hello,start resting in 5 minutes"
21 f.writeline("start resting in 5 minutes at ")
22 f.writeline(time)
23 f.writeblanklines(1)
24 count=count+1
25 wscript.sleep 1000*60*5
26 next
27 time = now
28 shell.toggledesktop
29 createobject("sapi.spvoice").speak  "4次番茄工作法循环结束,开始持续20分钟休息"
30 msgbox "hello,4 times tomato work method end"
31 f.writeblanklines(1)
32 f.write("number of tasks started: ")
33 f.writeline(j)
34 f.writeline("start resting after 4 times tomato work method at ")
35 f.writeline(time)
36 wscript.sleep 1000*60*20
37 next
38 f.close()
39 set f = nothing
40 set fso = nothing

 

为适应强迫症增加vds定时器调用如下:

 1 include "d:\test.vbs"
 2  
 3 sub include(sinstfile) 
 4     dim ofso, f, s, w, time
 5     set ofso = createobject("scripting.filesystemobject") 
 6     set f = ofso.opentextfile(sinstfile) 
 7     set w = ofso.opentextfile("d:\timing.txt",8,true)
 8     count = 1
 9     'wscript.sleep 1000*60*14
10     time = now
11     msgbox "hello,start resting in 5 minutes"
12     createobject("sapi.spvoice").speak  "集中注意力时间结束,开始持续5分钟休息"
13     w.write("number of tasks started: ")
14     w.writeline(count)
15     w.writeline("start resting in 5 minutes at ")
16     w.writeline(time)
17     count=count+1
18     wscript.sleep 1000*60*3
19     s = f.readall 
20     f.close 
21     set f = nothing
22     set ofso = nothing
23     executeglobal s 
24     set w = nothing
25 end sub