经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Windows » 查看文章
用vbs脚本简易实现 番茄工作法
来源:cnblogs  作者:RT2018  时间:2019/8/15 11:54:50  对本文有异议

番茄工作法:

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

25min工作+5min休息

 

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

 VBS代码实现如下:

  1. 1 Dim fso,f,count,time,shell
  2. 2 set fso=wscript.CreateObject("Scripting.FileSystemObject")
  3. 3 set f=fso.opentextfile("d:\test.txt",8,true)
  4. 4 Set shell = CreateObject("Shell.Application")
  5. 5 count = 1
  6. 6 for j = 1 to 3
  7. 7 for i = 1 to 4
  8. 8 time = Now
  9. 9 shell.ToggleDesktop
  10. 10 CreateObject("SAPI.SpVoice").Speak "开始持续25分钟集中注意力"
  11. 11 MsgBox "hello,Start focusing in 25 minutes"
  12. 12 f.Write("Number of tasks started: ")
  13. 13 f.WriteLine(count)
  14. 14 f.WriteLine("Start focusing in 25 minutes at ")
  15. 15 f.WriteLine(time)
  16. 16 wscript.sleep 1000*60*25
  17. 17 time = Now
  18. 18 shell.ToggleDesktop
  19. 19 CreateObject("SAPI.SpVoice").Speak "集中注意力时间结束,开始持续5分钟休息"
  20. 20 MsgBox "hello,Start resting in 5 minutes"
  21. 21 f.WriteLine("Start resting in 5 minutes at ")
  22. 22 f.WriteLine(time)
  23. 23 f.WriteBlankLines(1)
  24. 24 count=count+1
  25. 25 wscript.sleep 1000*60*5
  26. 26 next
  27. 27 time = Now
  28. 28 shell.ToggleDesktop
  29. 29 CreateObject("SAPI.SpVoice").Speak "4次番茄工作法循环结束,开始持续20分钟休息"
  30. 30 MsgBox "hello,4 times tomato work method end"
  31. 31 f.WriteBlankLines(1)
  32. 32 f.Write("Number of tasks started: ")
  33. 33 f.WriteLine(j)
  34. 34 f.WriteLine("Start resting after 4 times tomato work method at ")
  35. 35 f.WriteLine(time)
  36. 36 wscript.sleep 1000*60*20
  37. 37 next
  38. 38 f.Close()
  39. 39 set f = nothing
  40. 40 set fso = nothing

 

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

  1. 1 Include "D:\test.vbs"
  2. 2
  3. 3 Sub Include(sInstFile)
  4. 4 Dim oFSO, f, s, w, time
  5. 5 Set oFSO = CreateObject("Scripting.FileSystemObject")
  6. 6 Set f = oFSO.OpenTextFile(sInstFile)
  7. 7 Set w = oFSO.opentextfile("d:\timing.txt",8,true)
  8. 8 count = 1
  9. 9 'wscript.sleep 1000*60*14
  10. 10 time = Now
  11. 11 MsgBox "hello,Start resting in 5 minutes"
  12. 12 CreateObject("SAPI.SpVoice").Speak "集中注意力时间结束,开始持续5分钟休息"
  13. 13 w.Write("Number of tasks started: ")
  14. 14 w.WriteLine(count)
  15. 15 w.WriteLine("Start resting in 5 minutes at ")
  16. 16 w.WriteLine(time)
  17. 17 count=count+1
  18. 18 wscript.sleep 1000*60*3
  19. 19 s = f.ReadAll
  20. 20 f.Close
  21. 21 Set f = Nothing
  22. 22 Set oFSO = Nothing
  23. 23 ExecuteGlobal s
  24. 24 set w = nothing
  25. 25 End Sub

 

原文链接:http://www.cnblogs.com/RT2018/p/11341729.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号