在内网里也需要个日志工具,后来用了eDiary。然而在使用过程中发现eDiary多次出现丢失日记的情况,虽然可能跟内网的云桌面不稳定有关系,但软件本身的保存机制大概有一些缺陷,每次写完日志后备份都避免不了。终于忍无可忍,决定换日志工具。
先试用CherryTree这个开源工具,特点是树状管理,能语法高亮,甚至执行代码等。虽然安装时没有中文可选,但安装后大部份选项已经本地化。网上有人反映其对中文支持不好。实际测试中,导入中文文件名的文件时会出问题,甚至崩溃。
所以最后还是用myBase这个评价普遍不错的工具(后来使用中曾发现在win7下myBase有时在鼠标滚轮滚动时程序会崩溃退出,不过貌似未发现数据丢失)。myBase desktop 7.3.5是当前最新版本。现在考虑如何把eDiary导出的文本格式日志文件导入myBase。eDiary导出后的目录结构大概是这样子:
test │ ├─文档 │ │ Oracle的17001错误分析.txt │ │ 任务验密.txt │ │ 20200325测试结果.txt │ │ 采购交易明细信息.txt │ └──直接在tar.gz文件里grep.txt │ └─日记 ├─2020-02-12 │ (无标题).txt │ ├─2020-02-21 │ (无标题).txt │ └─2020-10-28 (无标题).txt
之前选用eDiary时曾经把txt格式的日志文件用AutoHotKey 2脚本插入过eDiary,如今换掉eDiary改投myBase,脚本需要修改一下,简单起见分成“日记”和“文档”两次来做。首先是导入日记的ahk脚本:
;"新建文档"156,113,内容:318,158 ^!n:: ; Ctrl+Alt+N CoordMode "Mouse", "Screen" str :="" ;WhichFolder := DirSelect() WhichFolder:="C:\Users\haha\Desktop\test\日记" Loop Files,WhichFolder "\*","D" { fn:=StrReplace(A_LoopFileName,"-","") fText := FileRead(A_LoopFileFullPath "\" "(无标题).txt","UTF-16") MouseClick "left",100,117 sleep 1000 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 MouseClick "left",47,97 sleep 2000 SendText fn sleep 2000 MouseClick "left",284,227 sleep 2000 sendtext fText sleep 2000 } return
然后是导入文档的ahk脚本:
;"新建文档"156,113,内容:318,158 ^!n:: ; Ctrl+Alt+N CoordMode "Mouse", "Screen" str :="" ;WhichFolder := DirSelect() WhichFolder:="C:\Users\haha\Desktop\test\文档" Loop Files,WhichFolder "\*.*","F" { fn:=SubStr(A_LoopFileName,1,StrLen(A_LoopFileName)-4) fText := FileRead(A_LoopFileFullPath ,"UTF-16") MouseClick "left",100,138 sleep 1000 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 send "{PgUp}" sleep 500 MouseClick "left",100,138 sleep 2000 MouseClick "left",47,97 sleep 2000 SendText fn sleep 2000 MouseClick "left",484,227 sleep 2000 sendtext fText sleep 4000 } return
综上,类似于按键精灵,AutoHotKey对待一些win平台下的自动化任务还是非常有用的。
原创文章,作者:苏葳,如需转载,请注明出处:https://www.swmemo.com/2210.html