Recommend a lightweight but efficient free open source windows hotkey scripting language AutoHotKey

Time:2020-11-27

The words written in the front

AutoHotKey is a lightweight, small but efficient, free and open source windows hotkey scripting language. Game manipulation, mouse operation, keyboard shortcut redefinition, shortcut phrases and so on, only you can’t imagine, without it, you can’t do it. The artifact of artifact, I hate to meet you late.

install

Download from official website

https://www.autohotkey.com/

Download the EXE file, double-click to install the next step

use

Documentation

  • Create a new text file in any location and change the suffix to. AHK

It is recommended to put the file in the boot directory, so that your script will be automatically loaded every time you boot, because once you use it, you will not be used to the days without it C: users / administrator / appdata / roaming / Microsoft / Windows / start menu / programs / startup

; notes: ා = win! = = ALT ^ = = Ctrl + = = shift; use semicolon ';'
;=====================================================
As a programmer, up and down around is the most used, you may not need to play games, change to the most convenient button for you
!j::Send {Left}  
!l::Send {Right}
!i::Send {Up}
!k::Send {Down}
!u::Send {Home}
!o::Send {End}
; win10's multi desktop is so easy to use, how can it not be used? Replace it with a shortcut desktop button for easy operation
!f::Send ^#{Right} 
!s::Send ^#{Left}
!n::Send ^+{F}
!Backspace::Send !{F4}
#z: Send {l}; lock the two buttons on the desktop too far away, not afraid, change to near
; open the browser, define the normal and privacy separately, and then load the shortcut key to define the size and location of the browser. I used the window size plug-in for this
!v::
Run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe https://www.baidu.com/
Sleep 2250; must have enough time, otherwise the instance has not been generated, how to execute the shortcut key
Send, ^+{A}
Return
!b::
Run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --incognito https://www.baidu.com/
;sleep 2250 
;Send ^+{B}
return
Open common folder, direct shortcut key, desktop that ten thousand year old "my computer" can be saved
!z::Run E:\FILE\Document\ZGDocument\  
!d::Run D:\
!e::Run E:\
#c: If you want to use an old console in win10 system, you have to look for a long time and add a quick call
There was a time when I used the Android simulator and needed to use the long press function. I wrote this one, and I found that its function was really powerful
!F2::
Send, {LButton Down}
Sleep 3000
Send, {LButton Up}
Return
With the help of another artifact scrcpy, you will find that computer operation of mobile phones has never been so simple. Here, add a few shortcut keys to realize the function of short video. Hey, you know
F8::
Send, {WheelDown 3}
Return
F4::
Send, {WheelUp 3}
Return
F7::
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%, , 0, D
MouseClick, , 0, -200, , 0, U, R
MouseMove, %xpos%, %ypos%, 0
Return
F6::
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%, , 0, D
MouseClick, , 0, 200, , 0, U, R
MouseMove, %xpos%, %ypos%, 0
Return

matters needing attention

Try to choose shortcuts that are easy to use but do not conflict with other keys

Mouse control

Mousegetpos get mouse position

grammar
MouseGetPos [, OutputVarX, OutputVarY, OutputVarWin, OutputVarControl, Flag]
Common parameters
  • Outputvarx, outputvery defines the variable used to save the current coordinate value, such as% XPOS% when referring to XPOS
example
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%

MouseClick mouse click

grammar
MouseClick [, WhichButton, X, Y, ClickCount, Speed, DownOrUp, Relative]
Common grammar
  • Which button ා the button to click, left left key by default, and right, middle
  • 10. Remember, move to the position specified by X / Y coordinate before clicking the mouseFirst move, then clickAnd relative toActive window
  • Speed ා the speed of mouse movement, between 0 and 100. 0 means instantaneous movement, and the default value is 2
  • Downorup ා the default is to click, and D or u can be specified to execute actions step by step. If it is left blank when dragging the mouse, it will pop up after pressing by default, that is, click D ᦇ press the mouse button without releasing, that is, long press u # to pop up the mouse button
  • If relative is left blank by default, the absolute coordinate R ා is used to move the distance relative to the current mouse position
example
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%, , 0, D
MouseClick, , 0, -200, , 0, U, R

MouseMove mouse move

grammar
MouseMove, X, Y [, Speed, Relative]
Common parameters

The basic use is the same as mouseClick

example
MouseMove, %xpos%, %ypos%