需求:everything的搜索历史按照搜索时间排序;(现在是按搜索次数排序的)
"Sun Jun 23, 2013 8:14 am"的时候作者就说:
Sorting search history by last search date in Everything is on my Things to do list.
但是看了更新日志,翻了菜单,并没有找到相关设置;
www.voidtools.com ? View topic - When does Everything saves the search history
==========================================================
Everything.exe的搜索历史记录保存在: "Search History.csv" ,包括这几项:Search,Search Count,Last Search Date
一个Everything的窗口要关闭之后,搜索记录才会保存到.csv文件里去;(或许有什么命令行参数可以让它直接保存,但是没找到;)
思路:用everyting_history.py处理Search History.csv把最近搜索的几条记录保存到searchWord.txt里,AHK在根据searchWord.txt的内容弹出菜单;
;2016-01-09 星期六 16:08
#singleinstance force
#include <MyLib>
SetWorkingDir %A_ScriptDir%
;EveryThing当前窗口退出之后才会重新加载Search History.csv
send {esc}
run,D:\programs\Everything\Everything.exe
sleep 200
runwait,everyting_history.py,,min
menuFile := "searchWord.txt"
n := 0
loop,read,%menuFile%
{
if A_LoopReadLine <>
{
n += 1
if(n<=9) {
menu,myMenu,add,&%n%. %A_LoopReadLine%,menuHandler
} else {
menu,myMenu,add,%A_LoopReadLine%,menuHandler
}
}
}
CoordMode,menu,Window
menu,myMenu,show,10,100
return
menuHandler:
word := RegExReplace(A_ThisMenuItem,"^&\d\. ","")
sendWord(word)
return
sendWord(word) {
#IfWinActive ahk_Class EVERYTHING
send % asc[word]
#if
}
#!/usr/bin/python
#coding:utf-8
#2015-08-04 15:58:07.574000
"""
"""
import sys
reload(sys)
sys.setdefaultencoding(‘utf8‘)
hisFilePath = ‘D:\programs\Everything\Search History.csv‘
hisFileL = open(hisFilePath).readlines()
hisFileL2 = hisFileL[::]
hisFileL2.sort(key=lambda x : x.split(‘,‘)[2] , reverse=True)
#open("1.txt",‘w‘).writelines(hisFileL2)
searchWord = []
for line in hisFileL2[1::]:
word = line.split(",")[0]
word = word[1:-1] #把双引号去掉;
word = word.strip()
word = word.encode("gbk")
if word :
searchWord.append(word)
open("searchWord.txt",‘w‘).writelines(‘\n‘.join(searchWord[0:30]))
e:\computer\AutoHotKey\12.Everythig_history_sortdate\
时间: 2024-10-05 23:54:27