阅读:65回复:3

AutoHotkey v2 Script辅助输入脚本

楼主#
更多 发布于:2026-01-09 18:29
使用环境:windows
前提有autohotkey坏境,autohotkey有绿色免安装版本,大小为3M。
下载地址为:https://www.autohotkey.com/download/
如何安装 AutoHotkey参考:https://wyagd001.github.io/v2/docs/howto/Install.htm
程序的使用:https://wyagd001.github.io/v2/docs/Program.htm
沙发#
发布于:2026-01-11 08:34
一次在多个网站查询汉字
默认的辞典网站是www.zdic.net,用户可以在配置文件中自定义。如:
[IM]
dict_cn=http://www.zdic.net/hans/%s

将上面的配置修改为
dict_cn=mb/app/dict_cn.ahk %s
使用下面的ahk即可同时在多个网站上进行查询
zdic := "http://www.zdic.net/hans/" A_Args[1]
lexi := "https://humanum.arts.cuhk.edu.hk//Lexis/lexi-mf/search.php?word=" A_Args[1]
zidian := "https://zidian.yw11.com/zi/" A_Args[1]
qxk := "https://qxk.bnu.edu.cn/#/danziDetail/49c12ccb-35cc-437b-af4a-3fe126df8fca/" A_Args[1] "/22d3af76-1ffe-46da-8c28-40e7dfe6b8d2/0"
run zdic
run lexi
run zidian
run qxk
板凳#
发布于:2026-01-11 01:22
重新启动小小输入法,用于让修改后的配置文件快速生效
TargetProcessName := "yong.exe"
TargetExePath := "d:\yong\w64\yong.exe"
if !FileExist(TargetExePath) {
    MsgBox "错误:未找到目标程序文件。`n路径: " TargetExePath
    ExitApp
}
try {
    pid := ProcessExist(TargetProcessName)
    if (pid = 0) {
        Run TargetExePath
    } else {
run "taskkill /im yong.exe"
        MaxWaitTime := 10000 ; 最多等待10秒
        StartTime := A_TickCount
        while ProcessExist(pid) {
            if (A_TickCount - StartTime > MaxWaitTime) {
                if MsgBox("程序关闭超时,是否强制终止?", "警告", "YesNo Icon!") = "Yes" {
                    ProcessClose pid ; 强制终止进程
                    Sleep 500 ; 稍等片刻让系统处理
                } else {
                    MsgBox "用户取消操作。"
                    ExitApp
                }
                break ; 退出循环
            }
            Sleep 500 ; 每500毫秒检查一次,避免CPU占用过高
        }
        if !ProcessExist(TargetProcessName) {
            Run TargetExePath
        } else {
            MsgBox "无法启动新实例,旧进程可能仍在运行。"
        }
    }
} catch as e {
    MsgBox "在操作过程中发生错误:`n" e.Message, "错误", "Iconx"
}
地板#
发布于:2026-01-09 18:34
仿在wps表格中按组合键ctrl+;输入日期,ctrl+shift+;输入时间。脚本如下
^;::
{
currentDateTime := A_Now
formatteDate := FormatTime(currentDateTime, "yyyy/M/d")
send formatteDate
}
^+;::
{
currentDateTime := A_Now
formatteTime := FormatTime(currentDateTime, "HH:mm")
send formatteTime
}
游客

返回顶部