[GoldenDict]AutoHotKey 划词翻译脚本

2018-11-25 16:50:18 +08:00
 rabbbit

需搭配 GoldenDict 使用, 启用 /禁用快捷键 Alt + 5, 默认禁用

双击翻译 划词翻译

脚本代码

; goldendict 查词
; 使用方法 
; 在需翻译单词上双击 /划词
; 启用 /禁用快捷键
; Alt + 5
Translate := false
!5:: 
    Translate := !Translate
    return
~LButton:: 
    if (!Translate) {
        return
    }
    CoordMode, Mouse, Screen
    MouseGetPos, x1, y1
    KeyWait, LButton
    MouseGetPos, x2, y2
    if (abs(x1-x2) > 10 || abs(y1-y2) > 10) {
        Translate()
    } 
    if (A_priorHotKey == "~LButton" && A_TimeSincePriorHotkey < 400) {
        Translate()
    }
    return
Translate() {
    Send, ^c
    len := strlen(Clipboard)
    if (len > 20 || len < 2)  { 
        ;MsgBox %len%
        return
    }
    FoundPos := RegExMatch(Clipboard, "[^A-Za-z' ]")
    if (FoundPos > 0) {
        return
    }
    ; 将此处替换为 GoldenDict.exe 所在位置的绝对路径
    run E:\GoldenDict\GoldenDict.exe  %Clipboard%
    Clipboard =
    return
}
3494 次点击
所在节点    分享创造
4 条回复
chuanqirenwu
2018-11-25 18:07:10 +08:00
何不下个有道词典?
rabbbit
2018-11-25 18:48:15 +08:00
@chuanqirenwu GoldenDict 可以自己加字典
Aura7988
2018-11-25 22:22:41 +08:00
这个脚本要怎么使用啊,Mac 上可以用吗?
rabbbit
2018-11-25 23:11:14 +08:00
@Aura7988 AutoHotKey 只有 windows 版本,Mac 用不了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/511345

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX