V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
rabbbit

[GoldenDict]AutoHotKey 划词翻译脚本

  •  
  •   rabbbit · Nov 25, 2018 · 4031 views
    This topic created in 2714 days ago, the information mentioned may be changed or developed.

    需搭配 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
    }
    
    chuanqirenwu
        1
    chuanqirenwu  
       Nov 25, 2018
    何不下个有道词典?
    rabbbit
        2
    rabbbit  
    OP
       Nov 25, 2018
    @chuanqirenwu GoldenDict 可以自己加字典
    Aura7988
        3
    Aura7988  
       Nov 25, 2018
    这个脚本要怎么使用啊,Mac 上可以用吗?
    rabbbit
        4
    rabbbit  
    OP
       Nov 25, 2018
    @Aura7988 AutoHotKey 只有 windows 版本,Mac 用不了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2655 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 14:26 · PVG 22:26 · LAX 07:26 · JFK 10:26
    ♥ Do have faith in what you're doing.