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 已打開



載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。