Introduction#
AutoHotKey is a tool that allows you to complete certain computer operations efficiently by writing your own code and setting keyboard shortcuts. Mastering this tool will greatly improve your work efficiency.
- You can press a shortcut key in 1 second and instantly reply with a pre-edited text. (The traditional method is: open the text - copy - switch windows - paste)
Source Code Sharing#
!n::Run notepad
;===Pin and Unpin
#t::
WinSet AlwaysOnTop,On,A
return
#y::
WinSet AlwaysOnTop,Off,A
return
!w::!F4
return
;===Open Applications=======================
>!s::
Run D:\documents\auto\clock
return
!t::
Run D:\documents\auto\Microsoft To Do
return
!u::
Run D:\documents\auto\uTools
return
>!q::
Run D:\documents\auto\Tencent QQ
return
!o::
Run D:\documents\auto\Obsidian
return
!v::
Run D:\documents\auto\Visual Studio Code
return
!j::
Run D:\documents\auto\calculator
return
>!w::
Run D:\documents\auto\WeChat
return
>!e::
Run D:\documents\auto\time
return
^1::
send !s
send !t
return
;Close Operation
#Esc::Send !{F4}
;===Open Websites===========================
>^9::
Run https://dict.youdao.com/ %lookup word%
return
>+s::
Run https://cn.bing.com/translator/ %Bing Translate%
return
;==After selecting keywords, press win+b to search on Bing and Zhihu simultaneously====================
#b:: ;win+b
Send ^c ;input ctrl+c
sleep,100 ;wait for 100 milliseconds
;Open Bing search based on the selected content
run https://cn.bing.com/search?q=%clipboard%
;run https://www.zhihu.com/search?type=content&q=%clipboard%
return
;==After selecting keywords, press win+z to search on Bing and Zhihu simultaneously====================
#z:: ;win+z
Send ^c ;input ctrl+c
sleep,100 ;wait for 100 milliseconds
;Open Bing search based on the selected content
run https://fy.tingclass.net/root/%clipboard%
;run https://www.zhihu.com/search?type=content&q=%clipboard%
return
;==After selecting keywords, press win+w to search on Bing and Zhihu simultaneously====================
#w:: ;win+z
Send ^c ;input ctrl+c
sleep,100 ;wait for 100 milliseconds
;Open Bing search based on the selected content
run https://fy.tingclass.net/w/%clipboard%
;run https://www.zhihu.com/search?type=content&q=%clipboard%
return
;====Quick Input, for example, input "xh" and then press space, it will automatically fill in the student ID=======================
>^+k::Send 😀
::sev::hugo server{Enter}
::xh:: ;【Fill in your student ID after the colon】
::sfz:: ;【Fill in your ID card number after the colon】
::yx:: ;【Fill in your email after the colon】
::qqh:: ;【Fill in your QQ number after the colon】
::sj:: ;【Fill in your phone number after the colon】
<!s::send %A_YYYY%-%A_MM%-%A_DD% ;【This is used to input formatted dates】
<!d::send,{TEXT}> [!note]-
;========Text Operation Commands================================
#+l:: ;Get the path of the currently selected file using a shortcut key
send ^c
sleep,200
clipboard=%clipboard% ;When copying in Windows, the clipboard saves the "path". It is just not a string, but converting it to a string allows it to be pasted.
tooltip,%clipboard% ;Tooltip text
sleep,500
tooltip,
return
#+m:: ;Copy the file name of the file where the mouse is currently located
;Please place your mouse on the target file location, and the file name will be copied for you
mouseclick, right
send,m
send,^c
send, {enter}
tooltip,The file name where the mouse is located has been copied to the clipboard
sleep, 1500
tooltip,
return
#+c:: ;Rename the file where the mouse is located to the contents of the clipboard
clipboard = %clipboard% ; Convert any copied file, HTML, or other formatted text to plain text
send,{F8}
sleep,100
mouseclick, right
send,m
send,^v
send, {enter}
tooltip,The file where the mouse is located has been renamed to the contents of the clipboard
sleep, 1500
tooltip,
return
;cosea version - Double-click the right mouse button to close the Chrome window
#IfWinActive, ahk_class Chrome_WidgetWin_1
~RButton::
intInterval := 500 ;If the double-click occurs within this time interval, it is considered a double-click.
if (A_PriorHotkey <> "~RButton" or A_TimeSincePriorHotkey > intInterval)
{
KeyWait, RButton
return
}
Send,^w
sleep,100
MouseMove, -10, -10, 0, R ;Move the coordinates 10 pixels to the upper left corner of the active window at the fastest speed
sleep,100
mouseclick, left
return
;cosea version - Double-click the middle mouse button to restore closed Chrome windows
#IfWinActive, ahk_class Chrome_WidgetWin_1
~MButton::
intInterval := 300 ;If the double-click occurs within this time interval, it is considered a double-click.
if (A_PriorHotkey <> "~MButton" or A_TimeSincePriorHotkey > intInterval)
{
KeyWait, MButton
return
}
send,^+t ;Restore closed Chrome windows
return
;ctrl+right mouse button to switch to left-handed numeric mode=========================
bLHDigitMode:=0
^h::
if(bLHDigitMode<1){
bLHDigitMode:=1
}
return
MsgBox Opened