源代码
#IfWinActive ahk_exe msedge.exe
{
; 有道查词
`::searchWord1()
; 收集单词
!`::collectWord()
}
#IfWinActive ahk_exe chrome.exe
{
; 有道查词
`::searchWord2()
; 收集单词
!`::collectWord()
}
searchWord2(){
Click right
SendInput, {S}
SendInput, {Enter}
}
searchWord1(){
Click right
SendInput, {Up 3}
SendInput, {Enter}
}
collectWord(){
clipboard = ; 让剪贴板初始为空, 这样可以使用 ClipWait 检测文本什么时候被复制到剪贴板中.
Send ^c
ClipWait
FileAppend, ===%A_Year%-%A_MM%-%A_DD%-%A_Hour%-%A_Min%-%A_Sec%`n%clipboard% `n`n, %A_ScriptDir%\english_learn_note.txt,UTF-8
ToolTip, added#
SetTimer, RemoveToolTip, -1000
return
RemoveToolTip:
ToolTip
return
}
#y::Suspend