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.

install

Download on official website

https://www.autohotkey.com/

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

use

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 https://wyagd001.github.io/zh-cn/docs/AutoHotkey.htm
  • 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
!v::
Run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe https://www.baidu.com/
sleep 2250 ;There must be enough time, or 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
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
!F2::
Send, {LButton Down}
Sleep 3000
Send, {LButton Up}
Return
;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
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 don't conflict with other keys

Mouse control

MouseGetPos get mouse position

grammar
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
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 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
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

Basically the same as MouseClick

example
MouseMove, %xpos%, %ypos%

Keywords: Windows Google github Android

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