码迷,mamicode.com
首页 > 编程语言 > 详细

07.everything的搜索历史按照搜索时间排序

时间:2016-02-07 09:46:41      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:

需求:everything的搜索历史按照搜索时间排序;(现在是按搜索次数排序的)
"Sun Jun 23, 2013 8:14 am"的时候作者就说:
Sorting search history by last search date in Everything is on my Things to do list.  
但是看了更新日志,翻了菜单,并没有找到相关设置;

==========================================================
Everything.exe的搜索历史记录保存在: "Search History.csv" ,包括这几项:Search,Search Count,Last Search Date
一个Everything的窗口要关闭之后,搜索记录才会保存到.csv文件里去;(或许有什么命令行参数可以让它直接保存,但是没找到;)

思路:用everyting_history.py处理Search History.csv把最近搜索的几条记录保存到searchWord.txt里,AHK在根据searchWord.txt的内容弹出菜单;


  1. ;2016-01-09 星期六 16:08
  2. #singleinstance force
  3. #include <MyLib>
  4. SetWorkingDir %A_ScriptDir%
  5. ;EveryThing当前窗口退出之后才会重新加载Search History.csv
  6. send {esc}
  7. run,D:\programs\Everything\Everything.exe
  8. sleep 200
  9. runwait,everyting_history.py,,min
  10. menuFile := "searchWord.txt"
  11. n := 0
  12. loop,read,%menuFile%
  13. {
  14. if A_LoopReadLine <>
  15. {
  16. n += 1
  17. if(n<=9) {
  18. menu,myMenu,add,&%n%. %A_LoopReadLine%,menuHandler
  19. } else {
  20. menu,myMenu,add,%A_LoopReadLine%,menuHandler
  21. }
  22. }
  23. }
  24. CoordMode,menu,Window
  25. menu,myMenu,show,10,100
  26. return
  27. menuHandler:
  28. word := RegExReplace(A_ThisMenuItem,"^&\d\. ","")
  29. sendWord(word)
  30. return
  31. sendWord(word) {
  32. #IfWinActive ahk_Class EVERYTHING
  33. send % asc[word]
  34. #if
  35. }


  1. #!/usr/bin/python
  2. #coding:utf-8
  3. #2015-08-04 15:58:07.574000
  4. """
  5. """
  6. import sys
  7. reload(sys)
  8. sys.setdefaultencoding(‘utf8‘)
  9. hisFilePath = ‘D:\programs\Everything\Search History.csv‘
  10. hisFileL = open(hisFilePath).readlines()
  11. hisFileL2 = hisFileL[::]
  12. hisFileL2.sort(key=lambda x : x.split(‘,‘)[2] , reverse=True)
  13. #open("1.txt",‘w‘).writelines(hisFileL2)
  14. searchWord = []
  15. for line in hisFileL2[1::]:
  16. word = line.split(",")[0]
  17. word = word[1:-1] #把双引号去掉;
  18. word = word.strip()
  19. word = word.encode("gbk")
  20. if word :
  21. searchWord.append(word)
  22. open("searchWord.txt",‘w‘).writelines(‘\n‘.join(searchWord[0:30]))
e:\computer\AutoHotKey\12.Everythig_history_sortdate\










07.everything的搜索历史按照搜索时间排序

标签:

原文地址:http://www.cnblogs.com/QIAOXINGXING001/p/5184571.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!