Recommend a lightweight but efficient open source windows hotkey scripting language Autohotkey

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, etc. only you can't think of it, but you can't do it without it. The artifact in artifact is too late to meet.


Download on official website

Download the exe file, double-click to install it, and then go to the next step


Document preparation

  • Create a new text file at 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 loaded automatically 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

  • Scripting: official reference
  • Here are some simple scripts that I use personally. They are far more powerful than that. They are waiting for your discovery. I have added the common instructions in the notes
; notes: use semicolon ';'
As a programmer, you can use the most up, down, left and right, and you can't play games without changing 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 It's so easy to use. How can I not use it? Replace it with an easy to operate shortcut desktop button
!f::Send ^#{Right} 
!s::Send ^#{Left}
!n::Send ^+{F}
!Backspace::Send !{F4}
#z::Send #{50} ; the two buttons for locking the desktop are too far away. I'm not afraid to change them into the near ones
;Open the browser, define the normal and privacy respectively, and then load the shortcut key to define the size and location of the browser. I use the Window Resize plug-in unit
Run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
sleep 2250 ;There must be enough time, or the instance has not been generated. How to execute the shortcut key
Send, ^+{A}
Run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --incognito
;sleep 2250 
;Send ^+{B}
You can save the "my computer" that has not changed for ten thousand years by opening common folders and pressing the shortcut key directly
!z::Run E:\FILE\Document\ZGDocument\  
!d::Run D:\
!e::Run E:\
#c: : run control; if the win10 system wants to use an old console, it needs to find it for half a day and add a shortcut call
;For a while android The simulator needs to use the long press function, so I wrote this, and I found its function is really powerful from then on
Send, {LButton Down}
Sleep 3000
Send, {LButton Up}
;With 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
Send, {WheelDown 3}
Send, {WheelUp 3}
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%, , 0, D
MouseClick, , 0, -200, , 0, U, R
MouseMove, %xpos%, %ypos%, 0
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%, , 0, D
MouseClick, , 0, 200, , 0, U, R
MouseMove, %xpos%, %ypos%, 0

matters needing attention

Try to choose shortcuts that are easy to use but don't conflict with other keys

Mouse control

MouseGetPos get mouse position

MouseGetPos [, OutputVarX, OutputVarY, OutputVarWin, OutputVarControl, Flag]
Common parameters
  • OutputVarX, OutputVarY define the variables used to save the current coordinate value, such as% xpos% when referring to xpos
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%

MouseClick mouse click

MouseClick [, WhichButton, X, Y, ClickCount, Speed, DownOrUp, Relative]
Common grammar
  • Which button? The button to be clicked, Left by default, and the other: right, Middle
  • 10. Y ා remember to move to the position specified by x/y coordinate before clicking, i.e. move first, then click, and relative to the active window
  • Speed ා the speed of mouse movement, between 0 and 100, 0 means instantaneous movement, the default value is 2
  • DownOrUp ා click by default, or specify D or U step-by-step execution actions. If it is used to leave blank when dragging the mouse, it will pop up after pressing by default, that is, click D ා quickly once pressing the mouse button, press U ා pop up the mouse button for a long time if the mouse button is not released
  • Leave Relative blank. By default, the absolute coordinate R is used, and the distance Relative to the current mouse position is used
MouseGetPos, xpos, ypos
MouseClick, , %xpos%, %ypos%, , 0, D
MouseClick, , 0, -200, , 0, U, R

MouseMove mouse move

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

Basically the same as MouseClick

MouseMove, %xpos%, %ypos%

Keywords: Windows Google github Android

Added by mikeylikesyou on Tue, 09 Jun 2020 10:12:22 +0300