banner
朝闻道

朝闻道

做个知行合一的人
email

效率提升——AutoHotkey 源码分享

介绍#

AutoHotKey 是一款通过自己编写代码,设置电脑快捷键完成某种指令,从而达到 “高效完成某些电脑操作” 的需求,掌握此工具,工作效率将大大提升。

  • 你可以用 1 秒按下快捷键,秒回复一段早已编辑好的文字。(传统方法是:打开文本 - 复制 - 切换窗口 - 粘贴)

源码分享#


!n::Run notepad
;===置顶与取消
#t::
WinSet AlwaysOnTop,On,A
return
#y::
WinSet AlwaysOnTop,Off,A
return
!w::!F4
return

;===打开应用=======================
>!s::
Run D:\documents\auto\时钟
return
!t::
Run D:\documents\auto\Microsoft To Do
return
!u::
Run D:\documents\auto\uTools
return
>!q::
Run D:\documents\auto\腾讯QQ
return
!o::
Run D:\documents\auto\Obsidian
return
!v::
Run D:\documents\auto\Visual Studio Code
return
!j::
Run D:\documents\auto\计算器
return
>!w::
Run D:\documents\auto\微信
return
>!e::
Run D:\documents\auto\时间
return

^1::
send !s
send !t
return

;关闭操作
#Esc::Send !{F4}

;===打开网站===========================
>^9::
Run https://dict.youdao.com/  	%查单词%
return
>+s::
Run https://cn.bing.com/translator/	%必应翻译%
return

;==选中关键字后,同时按下win+b,必应+知乎搜索====================
#b::  			;win+b
	Send ^c   	;输入 ctrl+c
	sleep,100  	;等待100毫秒
	;根据选中的内容打开必应搜索
	run https://cn.bing.com/search?q=%clipboard%
	;run https://www.zhihu.com/search?type=content&q=%clipboard%
return

;==选中关键字后,同时按下win+z,必应+知乎搜索====================
#z::  			;win+z
	Send ^c   	;输入 ctrl+c
	sleep,100  	;等待100毫秒
	;根据选中的内容打开必应搜索
	run https://fy.tingclass.net/root/%clipboard%
	;run https://www.zhihu.com/search?type=content&q=%clipboard%
return


;==选中关键字后,同时按下win+w,必应+知乎搜索====================
#w::  			;win+z
	Send ^c   	;输入 ctrl+c
	sleep,100  	;等待100毫秒
	;根据选中的内容打开必应搜索
	run https://fy.tingclass.net/w/%clipboard%
	;run https://www.zhihu.com/search?type=content&q=%clipboard%
return

;====快速输入,比如输入“xh"再按空格,会自动填写学号=======================
>^+k::Send 😀
::sev::hugo server{Enter}
::xh::              ;【在冒号后填写你的学号】
::sfz::             ;【在冒号后填写你的身份证号】
::yx::              ;【在冒号后填写你的邮箱号】
::qqh::             ;【在冒号后填写你的QQ号】
::sj::              ;【在冒号后填写你的手机号】
<!s::send %A_YYYY%-%A_MM%-%A_DD%  ;【这个是用来输入格式化日期的】

<!d::send,{TEXT}> [!note]- 


;========文本操作命令================================
#+l:: ;用快捷键得到当前选中文件的路径
send ^c
sleep,200
clipboard=%clipboard% ;windows 复制的时候,剪贴板保存的是“路径”。只是路径不是字符串,只要转换成字符串就可以粘贴出来了
tooltip,%clipboard% ;提示文本
sleep,500
tooltip,
return

#+m:: ;复制当前鼠标所在文件文件名
;请将你的鼠标放在目标文件位置,即将为你复制其文件名
mouseclick, right
send,m
send,^c
send, {enter}
tooltip,已将鼠标所在文件名复制到剪切板
sleep, 1500
tooltip,
return

#+c:: ;将鼠标所在文件重命名为剪切板内容
clipboard = %clipboard%   ; 把任何复制的文件, HTML 或其他格式的文本转换为纯文本
send,{F8}
sleep,100
mouseclick, right
send,m
send,^v
send, {enter}
tooltip,已为你将鼠标所在文件重命名为剪切板内容
sleep, 1500
tooltip,
return

;cosea版-双击鼠标右键版关闭Chrome窗口
#IfWinActive, ahk_class Chrome_WidgetWin_1
~RButton::
intInterval := 500  ;若两次连击在这个时间间隔中,则视为双击。
if (A_PriorHotkey <> "~RButton" or A_TimeSincePriorHotkey > intInterval)
{
    KeyWait, RButton
    return
}
Send,^w
sleep,100
MouseMove, -10, -10, 0, R ;坐标相对于活动窗口向左上角以最快的速度移动10个像素
sleep,100
mouseclick, left
return

;cosea版-双击鼠标中键恢复关闭的Chrome窗口
#IfWinActive, ahk_class Chrome_WidgetWin_1
~MButton::
intInterval := 300  ;若两次连击在这个时间间隔中,则视为双击。
if (A_PriorHotkey <> "~MButton" or A_TimeSincePriorHotkey > intInterval)
{
KeyWait, MButton
return
}
send,^+t ;恢复关闭的Chrome窗口
return

;ctrl+鼠标右键切换左手键输入纯数字模式=========================
bLHDigitMode:=0
^h::
if(bLHDigitMode<1){
bLHDigitMode:=1
}
return

MsgBox 已打开



加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。