1 Star 0 Fork 1

Total/AHK

forked from Em0s_Er1t/AHK 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Em0s_Er1t.ahk 37.73 KB
一键复制 编辑 原始数据 按行查看 历史
Em0s_Er1t 提交于 2021-12-17 11:13 . update Em0s_Er1t.ahk.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
;这里是一些初始设置
Run "D:\TIM\Bin\QQScLauncher.exe" ;每次自动开启QQ
#MaxThreadsPerHotkey 4
SetCapsLockState, AlwaysOff ;为了便于后面CapsLock的使用,这里一开始先把CapsLock按键关闭,后面由CapsLock + Tab代替切换大小写功能
#ClipboardTimeout -1 ;设置如果访问剪切板失败则持续访问剪切板
;-------------------------------------------------------------------------------------------------------------------------------------------
;说明:
; ① 改自Jon的屏幕键盘(https://ahkcn.github.io/docs/scripts/KeyboardOnScreen.htm),
; ② 原来的版本有点老了,直接用可能有乱码,就稍微改了改使其完全适配新版本
; ③ 而且每次自动显示屏幕键盘,个人不是很喜欢这种模式,就改成了快捷键Ctrl+`触发开启/关闭虚拟键盘
; ④ 此脚本会在屏幕的底部创建一个模拟键盘来实时显示您按下的按键,学习盲打的人可以入手试试.
; ⑤ 最后一点,里面一些Unicode字符可以改,标注在代码注释里了
; On-Screen ANSI Keyboard version 3 (original discussion at https://redd.it/kxh9rb)
; This customizable, non-interactive keyboard only flashes what you type. It may be used to:
; Memorize the ANSI keyboard format without looking down
; Record your keystrokes (like in a game or something)
; Check key functionality on a damaged keyboard
; Revel in or lament over your typing speed
; /u/KeronCyst added all buttons to the right of Backspace, added a Ctrl-` visibility toggle, cleaned up
; code descriptions, and made the keyboard click-through/non-interactive by default.
; /u/anonymous1184 used invisible characters (to differentiate Numpad numbers from their counterparts) and
; labels (to eliminate version 2's lists of manual character entries).
; Both redditors made aesthetic improvements (symbols + name changes) and fixed various flashing problems.
; Version 2 added color-flashing via progress bars by Lehnemann:
; https://autohotkey.com/board/topic/94703-another-approach-to-a-virtual-keyboard/
; Version 1 by Jon: http://www.autohotkey.com
; Press Ctrl-` or double-click (or right-click) the tray icon to toggle visibility of the keyboard.
; Run a search for and delete the following to make the keyboard:
; • Clickable (Escape will then close the keyboard if it's focused on):
; +E0x20
; • Draggable:
; -Caption
; 搜索 "Transparency" 改透明度.
; 搜索 "BackgroundAqua" 可以改Aqua为别的颜色名称
; Usable colors: https://www.autohotkey.com/docs/commands/Progress.htm#colors
; Changing this font size will resize the keyboard:
k_FontSize = 10
k_FontName = Verdana ; This can be blank to use the system's default font.
k_FontStyle = Bold ; Example of an alternative: Italic Underline
; Names for the tray menu items:
k_MenuItemHide := "Hide keyboard"
k_MenuItemShow := "Show keyboard"
; Put "2" to set the keyboard on monitor 2, etc. (blank = primary monitor):
k_Monitor =
;---- Alter the tray icon menu:
;Menu, Tray, Add, %k_MenuItemHide%, k_ShowHide
;Menu, Tray, Add, &Exit, k_MenuExit
;Menu, Tray, Default, %k_MenuItemHide%
;Menu, Tray, NoStandard ;移除原任务栏图标菜单
;---- Calculate object dimensions based on chosen font size:
k_KeyWidth := k_FontSize * 3
k_KeyHeight := k_FontSize * 3
k_KeyWidth0 := k_KeyWidth * 2
; Spacing to be used between the keys.
k_KeyMargin := k_FontSize // 6
; The total width of the keyboard in terms of the keys and their margins.
width := 15 * k_KeyWidth + 14 * k_KeyMargin
; Values for specially sized keys. The first and last keys of each row are critical for proper sizing.
k_KeyWidthHalf := k_KeyWidth / 2
k_TabW := k_FontSize * 4
k_CapsW := k_KeyWidth + k_KeyMargin + k_KeyWidthHalf
k_ShiftW := 2 * k_KeyWidth + k_KeyMargin
k_SpacebarWidth := k_FontSize * 17
k_LastKeyWidth := width - ( k_TabW + 12 * k_KeyWidth + 13 * k_KeyMargin )
k_EnterWidth := width - ( k_CapsW + 11 * k_KeyWidth + 12 * k_KeyMargin )
k_LastShiftWidth := width - ( k_ShiftW + 10 * k_KeyWidth + 11 * k_KeyMargin )
k_LastCtrlWidth := width - ( 6 * k_TabW + k_SpacebarWidth + 7 * k_KeyMargin )
; Only a facilitator for creating GUI.
k_KeySize = w%k_KeyWidth% h%k_KeyHeight%
k_KeySize0 = w%k_KeyWidth0% h%k_KeyHeight%
k_Position = x+%k_KeyMargin% %k_KeySize%
k_Numpad0 = x+%k_KeyMargin% %k_KeySize0%
; This table is used to relate the hotkeys pressed with their progress bars to flash them when pressed.
k_Characters := {"" : ""
, "``" : 1
, 1 : 2
, 2 : 3
, 3 : 4
, 4 : 5
, 5 : 6
, 6 : 7
, 7 : 8
, 8 : 9
, 9 : 10
, 0 : 11
, "-" : 12
, "=" : 13
, "Backspace" : 14
, "Tab" : 15
, "Q" : 16
, "W" : 17
, "E" : 18
, "R" : 19
, "T" : 20
, "Y" : 21
, "U" : 22
, "I" : 23
, "O" : 24
, "P" : 25
, "[" : 26
, "]" : 27
, "\" : 28
, "CapsLock" : 29
, "A" : 30
, "S" : 31
, "D" : 32
, "F" : 33
, "G" : 34
, "H" : 35
, "J" : 36
, "K" : 37
, "L" : 38
, ";" : 39
, "'" : 40
, "Enter" : 41
, "LShift" : 42
, "Z" : 43
, "X" : 44
, "C" : 45
, "V" : 46
, "B" : 47
, "N" : 48
, "M" : 49
, "," : 50
, "." : 51
, "/" : 52
, "RShift" : 53
, "LCtrl" : 54
, "LWin" : 55
, "LAlt" : 56
, "Space" : 57
, "RAlt" : 58
, "RWin" : 59
, "AppsKey" : 60
, "RCtrl" : 61
, "Insert" : 62
, "Home" : 63
, "PgUp" : 64
, "Delete" : 65
, "End" : 66
, "PgDn" : 67
, "Up" : 68
, "Left" : 69
, "Down" : 70
, "Right" : 71
, "NumLock" : 72
, "NumpadDiv" : 73
, "NumpadMult" : 74
, "NumpadSub" : 75
, "Numpad7" : 76
, "Numpad8" : 77
, "Numpad9" : 78
, "NumpadAdd" : 79
, "Numpad4" : 80
, "Numpad5" : 81
, "Numpad6" : 82
, "Numpad1" : 83
, "Numpad2" : 84
, "Numpad3" : 85
, "NumpadEnter" : 86
, "Numpad0" : 87
, "NumpadDot" : 88 }
zwnbs := Chr(8204) ; Zero-width non-breaking space
;Unicode 图案显示
labels := { "" : ""
, "AppsKey" : "App"
, "BackSpace" : Chr(0x21DA)
, "CapsLock" : "Caps"
, "Delete" : "Del"
, "Down" : Chr(0x25BC)
, "End" : Chr(0x21F2)
, "Home" : Chr(0x21F1)
, "Insert" : "Ins"
, "LAlt" : "Alt"
, "LCtrl" : "Ctrl"
, "Left" : Chr(0x140A)
, "LShift" : "Shift"
, "LWin" : "Win"
, "NumLock" : Chr(0x1F512)
, "Numpad0" : "0" zwnbs
, "Numpad1" : "1" zwnbs
, "Numpad2" : "2" zwnbs
, "Numpad3" : "3" zwnbs
, "Numpad4" : "4" zwnbs
, "Numpad5" : "5" zwnbs
, "Numpad6" : "6" zwnbs
, "Numpad7" : "7" zwnbs
, "Numpad8" : "8" zwnbs
, "Numpad9" : "9" zwnbs
, "NumpadAdd" : "+"
, "NumpadDiv" : "/" zwnbs
, "NumpadDot" : "." zwnbs
, "NumpadEnter": "Ent"
, "NumpadMult" : "*"
, "NumpadSub" : "-" zwnbs
, "PgDn" : "PD"
, "PgUp" : "PU"
, "RAlt" : "Alt" zwnbs
, "RCtrl" : "Ctrl" zwnbs
, "Right" : Chr(0x1405)
, "RShift" : "Shift" zwnbs
, "RWin" : "Win" zwnbs
, "Space" : Chr(0x1F924)
, "Tab" : "Tab"
, "Up" : Chr(0x25B2) }
; Control whether the virtual keyboard is displayed on the screen or not.
k_IsVisible = n
initvar := 1
Ctrl & `::
if k_IsVisible = y
{
Gui, Cancel
k_IsVisible = n
}
else
{
if initvar=1
{
;---- Create a GUI window for the on-screen keyboard:
Gui, Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
Gui, +E0x20 -Caption +AlwaysOnTop -MaximizeBox +ToolWindow
; About keyboards: Tab and Ctrl have the same size, all the buttons on the far right fit to the size of the
; keyboard (dictated by the first line), Left Shift is the same size as Backspace (on Western keyboards), and
; the window size is given by x1 + 15 * + 14 * wKey kMargin and y1 + 5 * 4 * + hKey kMargin (where x1 and y1
; are the coordinates of the first key on the top left of the keyboard).
; The first row of the virtual keyboard.
Gui, Add, Progress, Section xm ym %k_KeySize% Disabled vprg1
Gui, Add, Progress, %k_Position% Disabled vprg2
Gui, Add, Progress, %k_Position% Disabled vprg3
Gui, Add, Progress, %k_Position% Disabled vprg4
Gui, Add, Progress, %k_Position% Disabled vprg5
Gui, Add, Progress, %k_Position% Disabled vprg6
Gui, Add, Progress, %k_Position% Disabled vprg7
Gui, Add, Progress, %k_Position% Disabled vprg8
Gui, Add, Progress, %k_Position% Disabled vprg9
Gui, Add, Progress, %k_Position% Disabled vprg10
Gui, Add, Progress, %k_Position% Disabled vprg11
Gui, Add, Progress, %k_Position% Disabled vprg12
Gui, Add, Progress, %k_Position% Disabled vprg13
Gui, Add, Progress, x+%k_KeyMargin% w%k_ShiftW% h%k_KeyHeight% Disabled vprg14
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg62 ; Insert
Gui, Add, Progress, %k_Position% Disabled vprg63 ; Home
Gui, Add, Progress, %k_Position% Disabled vprg64 ; PgUp
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg72 ; NumLock
Gui, Add, Progress, %k_Position% Disabled vprg73 ; NumpadDiv
Gui, Add, Progress, %k_Position% Disabled vprg74 ; NumpadMult
Gui, Add, Progress, %k_Position% Disabled vprg75 ; NumpadSub
; The second row.
Gui, Add, Progress, xm y+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg15
Gui, Add, Progress, %k_Position% Disabled vprg16
Gui, Add, Progress, %k_Position% Disabled vprg17
Gui, Add, Progress, %k_Position% Disabled vprg18
Gui, Add, Progress, %k_Position% Disabled vprg19
Gui, Add, Progress, %k_Position% Disabled vprg20
Gui, Add, Progress, %k_Position% Disabled vprg21
Gui, Add, Progress, %k_Position% Disabled vprg22
Gui, Add, Progress, %k_Position% Disabled vprg23
Gui, Add, Progress, %k_Position% Disabled vprg24
Gui, Add, Progress, %k_Position% Disabled vprg25
Gui, Add, Progress, %k_Position% Disabled vprg26
Gui, Add, Progress, %k_Position% Disabled vprg27
Gui, Add, Progress, x+%k_KeyMargin% w%k_LastKeyWidth% h%k_KeyHeight% Disabled vprg28
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg65 ; Delete
Gui, Add, Progress, %k_Position% Disabled vprg66 ; End
Gui, Add, Progress, %k_Position% Disabled vprg67 ; PgDn
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg76 ; Numpad7
Gui, Add, Progress, %k_Position% Disabled vprg77 ; Numpad8
Gui, Add, Progress, %k_Position% Disabled vprg78 ; Numpad9
Gui, Add, Progress, %k_Position% Disabled vprg79 ; NumpadAdd
; The third row.
Gui, Add, Progress, xm y+%k_KeyMargin% w%k_CapsW% h%k_KeyHeight% Disabled vprg29
Gui, Add, Progress, %k_Position% Disabled vprg30
Gui, Add, Progress, %k_Position% Disabled vprg31
Gui, Add, Progress, %k_Position% Disabled vprg32
Gui, Add, Progress, %k_Position% Disabled vprg33
Gui, Add, Progress, %k_Position% Disabled vprg34
Gui, Add, Progress, %k_Position% Disabled vprg35
Gui, Add, Progress, %k_Position% Disabled vprg36
Gui, Add, Progress, %k_Position% Disabled vprg37
Gui, Add, Progress, %k_Position% Disabled vprg38
Gui, Add, Progress, %k_Position% Disabled vprg39
Gui, Add, Progress, %k_Position% Disabled vprg40
Gui, Add, Progress, x+%k_KeyMargin% w%k_EnterWidth% h%k_KeyHeight% Disabled vprg41
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg80 ; Numpad4
Gui, Add, Progress, %k_Position% Disabled vprg81 ; Numpad5
Gui, Add, Progress, %k_Position% Disabled vprg82 ; `
; The fourth row.
Gui, Add, Progress, xm y+%k_KeyMargin% w%k_ShiftW% h%k_KeyHeight% Disabled vprg42
Gui, Add, Progress, %k_Position% Disabled vprg43
Gui, Add, Progress, %k_Position% Disabled vprg44
Gui, Add, Progress, %k_Position% Disabled vprg45
Gui, Add, Progress, %k_Position% Disabled vprg46
Gui, Add, Progress, %k_Position% Disabled vprg47
Gui, Add, Progress, %k_Position% Disabled vprg48
Gui, Add, Progress, %k_Position% Disabled vprg49
Gui, Add, Progress, %k_Position% Disabled vprg50
Gui, Add, Progress, %k_Position% Disabled vprg51
Gui, Add, Progress, %k_Position% Disabled vprg52
Gui, Add, Progress, x+%k_KeyMargin% w%k_LastShiftWidth% h%k_KeyHeight% Disabled vprg53
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg68 ; Up
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg83 ; Numpad1
Gui, Add, Progress, %k_Position% Disabled vprg84 ; Numpad2
Gui, Add, Progress, %k_Position% Disabled vprg85 ; Numpad3
Gui, Add, Progress, %k_Position% Disabled vprg86 ; NumpadEnter
; The last row of keys.
Gui, Add, Progress, xm y+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg54
Gui, Add, Progress, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg55
Gui, Add, Progress, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg56
Gui, Add, Progress, x+%k_KeyMargin% w%k_SpacebarWidth% h%k_KeyHeight% Disabled vprg57
Gui, Add, Progress, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg58
Gui, Add, Progress, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg59
Gui, Add, Progress, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight% Disabled vprg60
Gui, Add, Progress, x+%lastPos% w%k_LastCtrlWidth% h%k_KeyHeight% Disabled vprg61
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled vprg69 ; Left
Gui, Add, Progress, %k_Position% Disabled vprg70 ; Down
Gui, Add, Progress, %k_Position% Disabled vprg71 ; Right
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Numpad0% Disabled vprg87 ; Numpad0
Gui, Add, Progress, %k_Position% Disabled vprg88 ; NumpadDot
;---- Add a button for each key. Position the first button with absolute
; coordinates so that all other buttons can be positioned relative to it:
; The first row of the virtual keyboard.
Gui, Add, Button, section xm ym %k_KeySize%, ``
Gui, Add, Button, %k_Position%, 1
Gui, Add, Button, %k_Position%, 2
Gui, Add, Button, %k_Position%, 3
Gui, Add, Button, %k_Position%, 4
Gui, Add, Button, %k_Position%, 5
Gui, Add, Button, %k_Position%, 6
Gui, Add, Button, %k_Position%, 7
Gui, Add, Button, %k_Position%, 8
Gui, Add, Button, %k_Position%, 9
Gui, Add, Button, %k_Position%, 0
Gui, Add, Button, %k_Position%, -
Gui, Add, Button, %k_Position%, =
Gui, Add, Button, x+%k_KeyMargin% w%k_ShiftW% h%k_KeyHeight%, % labels["Backspace"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, Ins
Gui, Add, Button, %k_Position%, % labels["Home"]
Gui, Add, Button, %k_Position%, % labels["PgUp"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, % labels["NumLock"]
Gui, Add, Button, %k_Position%, % labels["NumpadDiv"]
Gui, Add, Button, %k_Position%, *
Gui, Add, Button, %k_Position%, % labels["NumpadSub"]
; The second row.
Gui, Add, Button, xm y+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["Tab"]
Gui, Add, Button, %k_Position%, Q
Gui, Add, Button, %k_Position%, W
Gui, Add, Button, %k_Position%, E
Gui, Add, Button, %k_Position%, R
Gui, Add, Button, %k_Position%, T
Gui, Add, Button, %k_Position%, Y
Gui, Add, Button, %k_Position%, U
Gui, Add, Button, %k_Position%, I
Gui, Add, Button, %k_Position%, O
Gui, Add, Button, %k_Position%, P
Gui, Add, Button, %k_Position%, [
Gui, Add, Button, %k_Position%, ]
Gui, Add, Button, x+%k_KeyMargin% w%k_LastKeyWidth% h%k_KeyHeight%, \
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, Del
Gui, Add, Button, %k_Position%, % labels["End"]
Gui, Add, Button, %k_Position%, % labels["PgDn"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, % labels["Numpad7"]
Gui, Add, Button, %k_Position%, % labels["Numpad8"]
Gui, Add, Button, %k_Position%, % labels["Numpad9"]
Gui, Add, Button, %k_Position%, +
; The third row.
Gui, Add, Button, xm y+%k_KeyMargin% w%k_CapsW% h%k_KeyHeight%, % labels["CapsLock"]
Gui, Add, Button, %k_Position%, A
Gui, Add, Button, %k_Position%, S
Gui, Add, Button, %k_Position%, D
Gui, Add, Button, %k_Position%, F
Gui, Add, Button, %k_Position%, G
Gui, Add, Button, %k_Position%, H
Gui, Add, Button, %k_Position%, J
Gui, Add, Button, %k_Position%, K
Gui, Add, Button, %k_Position%, L
Gui, Add, Button, %k_Position%, `;
Gui, Add, Button, %k_Position%, '
Gui, Add, Button, x+%k_KeyMargin% w%k_EnterWidth% h%k_KeyHeight%, Enter
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, % labels["Numpad4"]
Gui, Add, Button, %k_Position%, % labels["Numpad5"]
Gui, Add, Button, %k_Position%, % labels["Numpad6"]
; The fourth row.
Gui, Add, Button, xm y+%k_KeyMargin% w%k_ShiftW% h%k_KeyHeight%, % labels["LShift"]
Gui, Add, Button, %k_Position%, Z
Gui, Add, Button, %k_Position%, X
Gui, Add, Button, %k_Position%, C
Gui, Add, Button, %k_Position%, V
Gui, Add, Button, %k_Position%, B
Gui, Add, Button, %k_Position%, N
Gui, Add, Button, %k_Position%, M
Gui, Add, Button, %k_Position%, `,
Gui, Add, Button, %k_Position%, .
Gui, Add, Button, %k_Position%, /
Gui, Add, Button, x+%k_KeyMargin% w%k_LastShiftWidth% h%k_KeyHeight%, % labels["RShift"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, % labels["Up"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, % labels["Numpad1"]
Gui, Add, Button, %k_Position%, % labels["Numpad2"]
Gui, Add, Button, %k_Position%, % labels["Numpad3"]
Gui, Add, Button, %k_Position%, % labels["NumpadEnter"]
; The last row of keys.
Gui, Add, Button, xm y+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["LCtrl"]
Gui, Add, Button, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["LWin"]
Gui, Add, Button, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["LAlt"]
Gui, Add, Button, x+%k_KeyMargin% w%k_SpacebarWidth% h%k_KeyHeight%, % labels["Space"]
Gui, Add, Button, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["RAlt"]
Gui, Add, Button, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["RWin"]
Gui, Add, Button, x+%k_KeyMargin% w%k_TabW% h%k_KeyHeight%, % labels["AppsKey"]
Gui, Add, Button, x+%k_KeyMargin% w%k_LastCtrlWidth% h%k_KeyHeight%, % labels["RCtrl"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Position%, % labels["Left"]
Gui, Add, Button, %k_Position%, % labels["Down"]
Gui, Add, Button, %k_Position%, % labels["Right"]
Gui, Add, Progress, %k_Position% Disabled ; Make some space
Gui, Add, Button, %k_Numpad0%, % labels["Numpad0"]
Gui, Add, Button, %k_Position%, % labels["NumpadDot"]
;---- Show the keyboard centered but not active (to maintain the current window's focus):
Gui, Show, xCenter NoActivate, Virtual Keyboard View
; Get the window's Width and Height through the GUI's name.
WinGetPos,,, k_WindowWidth, k_WindowHeight, Virtual Keyboard View
;---- Position the keyboard at the bottom of the screen while avoiding the taskbar:
SysGet, k_WorkArea, MonitorWorkArea, %k_Monitor%
; Calculate window's X-position:
k_WindowX = %k_WorkAreaRight%
k_WindowX -= %k_WorkAreaLeft% ; Now k_WindowX contains the width of this monitor.
k_WindowX -= %k_WindowWidth%
k_WindowX /= 2 ; Calculate position to center it horizontally.
; The following is done in case the window will be on a non-primary monitor
; or if the taskbar is anchored on the left side of the screen:
k_WindowX += %k_WorkAreaLeft%
; Calculate window's Y-position:
k_WindowY = %k_WorkAreaBottom%
k_WindowY -= %k_WindowHeight%
; Move the window to the bottom-center position of the monitor.
WinMove, Virtual Keyboard View,, %k_WindowX%, %k_WindowY%
; Make the window transparent (the number regulates the transparency).
WinSet, Transparent, 128, Virtual Keyboard View
k_IsVisible = y
; --- Set all keys as hotkeys. See www.asciitable.com
k_n = 1
k_ASCII = 45
Loop {
; Change number into a real character.
k_char := Chr(k_ASCII)
; These keys are only accessible using modifier keys; that's why we're escaping them.
if k_char not in <,>,^,`,
Hotkey, ~*%k_char%, flashButton
; In the above, the asterisk prefix allows the key to be detected regardless
; of whether the user is holding down modifier keys such as Control and Shift.
; And without "~" the character wouldn't be shown in the window.
k_ASCII++
; Stop looping at the last key of the keyboard ("]").
} until (k_ASCII = 94)
initvar+=+1
}
else
{
; Do the opposite.
Gui, Show
k_IsVisible = y
}
}
return ; End of auto-execute section.
;---- When a key is pressed by the user, flash the corresponding button on-screen:
; Fire the corresponding subroutine when we press special + normal keys.
~*`::
~*Backspace::
~*Tab::
~*CapsLock::
~*'::
~*Enter::
~*LShift::
~*,::
~*RShift::
~*LCtrl:: ; Must use Ctrl, not Control, to match button names.
~*LWin::
~*LAlt::
~*Space::
~*RAlt::
~*RWin::
~*AppsKey::
~*RCtrl::
~*Insert::
~*Home::
~*PgUp::
~*Delete::
~*End::
~*PgDn::
~*Up::
~*Left::
~*Down::
~*Right::
~*NumLock::
~*NumpadDiv::
~*NumpadMult::
~*Numpad7::
~*Numpad8::
~*Numpad9::
~*Numpad4::
~*Numpad5::
~*Numpad6::
~*Numpad1::
~*Numpad2::
~*Numpad3::
~*Numpad0::
~*NumpadDot::
~*NumpadSub::
~*NumpadAdd::
~*NumpadEnter::flashButton()
; Function used to flash the button.
flashButton()
{
; Erase the key ("~*").
StringReplace, k_ThisHotkey, A_ThisHotkey, ~*
; Prevents the T and B keys from being confused as Tab and Backspace.
SetTitleMatchMode, 3
; Find the variable's index for the control.
global k_Characters
index := k_Characters[k_ThisHotkey]
; Change the color of the corresponding progress bar to red
; (beginning of the flashing's process).
GuiControl, +BackgroundAqua, prg%index%
; Wait for the release of the key.
KeyWait, %k_ThisHotkey%
; Remove the flash color.
GuiControl, -Background, prg%index%
; Redraw the button on release (needed because the buttons' names differ from the hotkeys' names).
global labels
if (labels.HasKey(k_ThisHotkey))
{
GuiControl, MoveDraw, % labels[k_ThisHotkey]
}
else
{
GuiControl, MoveDraw, % k_ThisHotkey
}
}
return
;----------------------------------------------------------------------------------------------------------------------------------------
;说明: 改自https://www.dcmembers.com/skrommel/download/altedge/,原版是默认打开的,且貌似要运行的化就要额外开一个脚本在后台了,就稍微改了一下。
;功能: Win+Z 热键 (可改变此热键)开启"当鼠标在左边沿时模拟按下 Alt-Tab 键"功能
#NoEnv
#Persistent,On
#SingleInstance,Force
#WinActivateForce
#MaxThreadsPerHotkey 3
#z:: ; Win+Z 热键 (可改变此热键)开启"当鼠标在左边沿时模拟按下 Alt-Tab 键"功能
#MaxThreadsPerHotkey 1
;MsgBox %KeepRunning%
if KeepRunning ; 这说明一个潜在的 线程 正在下面的循环中运行.
{
KeepRunning := false ; 向那个线程的循环发出停止的信号.
return ; 结束此线程, 这样才可以让下面的线程恢复并得知上一行所做的更改.
}
KeepRunning := True
SetBatchLines,-1
SetWinDelay,0
SetKeyDelay,0
CoordMode,Mouse,Screen
tabbed=0
Loop
{
MouseGetPos,mx,my
If (mx=0)
{
If tabbed=0
{
Send,{Alt Down}{Tab}
SetTimer,TAB1,500
}
tabbed=1
}
Else
{
If tabbed=1
{
SetTimer,TAB1,Off
Send,{Alt Up}
tabbed=0
}
}
Sleep,50
if not KeepRunning ; 用户再次按下 Win-Z 来向循环发出停止的信号.
break ; 跳出此循环.
}
KeepRunning := false
return
TAB1:
Send,{Alt Down}{Tab}
Return
;--------------------------------------------------------------------------------------------------------------------------
;功能:输入@1后按下enter终止符后自动替换成你的邮箱
::@1::
Clipboard:=".......@qq.com" ;可改
ClipWait 0.5 ; Wait for the copied text to arrive at the clipboard.
Send ^v
return
::@2::
Clipboard:="........@qq.com"
ClipWait 0.5 ; Wait for the copied text to arrive at the clipboard.
Send ^v
return
::@3::
Clipboard:=".........@gmail.com"
ClipWait 0.5 ; Wait for the copied text to arrive at the clipboard.
Send ^v
return
;功能:输入nname后按下enter终止符后自动替换成你的网名
::nname::
Clipboard:="Em0s_Er1t"
ClipWait 0.5
Send ^v
return
;功能:输入ALT+1后按下enter终止符后自动插入序号①,后面的以此类推
!1::
Clipboard:=Chr(0x2460)
ClipWait 0.5
Send ^v
return
!2::
Clipboard:=Chr(0x2461)
ClipWait 0.5
Send ^v
return
!3::
Clipboard:=Chr(0x2462)
ClipWait 0.5
Send ^v
return
!4::
Clipboard:=Chr(0x2463)
ClipWait 0.5
Send ^v
return
!5::
Clipboard:=Chr(0x2464)
ClipWait 0.5
Send ^v
return
!6::
Clipboard:=Chr(0x2465)
ClipWait 0.5
Send ^v
return
!7::
Clipboard:=Chr(0x2466)
ClipWait 0.5
Send ^v
return
!8::
Clipboard:=Chr(0x2467)
ClipWait 0.5
Send ^v
return
!9::
Clipboard:=Chr(0x2468)
ClipWait 0.5
Send ^v
return
!0::
Clipboard:=Chr(0x2469)
ClipWait 0.5
Send ^v
return
;这里的是输入『』
![::
Clipboard:=Chr(0x300E)
ClipWait 0.5
Send ^v
return
!]::
Clipboard:=Chr(0x300F)
ClipWait 0.5
Send ^v
return
;--------------------------------------------------------------------------------------------------------------------------
;功能:鼠标光标放到任务栏后滚动可调节音量
#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
#If
;--------------------------------------------------------------------------------------------------------------------------
;功能:按下CapsLock+1打开应用
CapsLock & 1::
run "D:\IDA7.0\ida64.exe"
Return
CapsLock & 2::
run "D:\IDA7.0\ida.exe"
Return
CapsLock & 4::
run "D:\vs2017\Common7\IDE\devenv.exe"
Return
CapsLock & 3::
run "D:\OllyDBG_1.10\OllyICE.exe"
Return
CapsLock & 5::
run "D:\vs2010\Common7\IDE\devenv.exe"
Return
CapsLock & 6::
run "D:\PyCharm 2018.2.4\bin\pycharm64.exe"
Return
CapsLock & 7::
run "D:\VMware15\vmware.exe"
Return
CapsLock & F1::
run "D:\Snipaste-2.5.6-Beta-x64\Snipaste.exe"
Return
CapsLock & F2::
run "D:\Auntec\HiRecMaster\HiRecMaster.exe"
Return
CapsLock & F3::
run "D:\Listary\Listary.exe"
Return
CapsLock & F4::
run "D:\DirectoryOpus\Directory Opus\dopus.exe"
Return
CapsLock & F5::
run "D:\Everything\Everything.exe"
Return
;功能: 窗口置顶
CapsLock & F12::
winset alwaysontop,toggle,A
winget, Transparent, Transparent, A
if (Transparent)
{
winset Transparent,Off,A
winset alwaysontop,off,A
}
else
{
winset Transparent,220,A
winset alwaysontop,on,A
}
Return
CapsLock & Q::
run "D:\TIM\Bin\QQScLauncher.exe"
Return
CapsLock & C::
run "D:\Tencent\WeChat\WeChat.exe"
Return
CapsLock & G::
run "C:\Program Files\Google\Chrome\Application\chrome.exe"
Return
CapsLock & M::
run "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
Return
CapsLock & P::
run "D:\Python3.9\python.exe"
Return
CapsLock & V::
run "D:\Clash for Windows\Clash for Windows.exe"
Return
CapsLock & T::
run "D:\Typora\Typora.exe"
Return
CapsLock & F::
run "D:\foobar2000_FlatLite\foobar2000.exe"
Return
CapsLock & O::
run "F:\LINK\Onenote.lnk"
Return
;切换大小写(相当于原来的CapsLock)
CapsLock & Tab::
GetKeyState, CapsLockState, CapsLock, T
if CapsLockState = D
SetCapsLockState, AlwaysOff
else
SetCapsLockState, AlwaysOn
KeyWait, Tab
Return
;功能: 窗口最大化
CapsLock & >::
WinMaximize A
Return
;功能: 窗口最小化
CapsLock & <::
WinMinimize A
Return
;功能: 窗口还原
CapsLock & ?::
WinRestore A
Return
CapsLock & Ctrl::
run,control
Return
;功能: 滑动关机
CapsLock & ESC::
run "C:\Windows\System32\SlideToShutDown.exe"
Return
;--------------------------------------------------------------------------------------------------------------------------
;功能:发送当前日期
;简介:利用剪贴板和正则匹配,在选中文本的行首加上注释符号
;操作:输入nnow+[一个空格]
:?:nnow:: ; 【?号表示在单词中也会替换,e.g. Vnnow → V2021.....】
FormatTime, CurrentDateTime,, yyyy/MM/dd HH:mm
Send %CurrentDateTime%
return
;复制 左键框住待复制内容, 不要松开, 按下右键即可复制.
; 配合 pro-显示 复制和剪切的内容.ahk 效果明显
~LButton & RButton::
{
send ^c
Sleep, 100 ;等待0.1s 强制机械等待剪贴板出现内容
;clip:=clipboard
StringLeft,clipboard_left,clipboard,500
Tooltip,%clipboard_left% ;在鼠标右侧显示clip(clipboard内容)
Sleep,800
Tooltip,
Return
}
;-------------------------------------------------------------------------------------------------------------------------
;粘贴 并鼠标下移30像素 并回车 左键+中键
~LButton & MButton::
{
Sleep, 300 ;等待0.3s 强制机械等待
Send ^v
MouseMove, 0, 30, 0, R ;
;MouseMove, 50, 0, 0, R ;鼠标右移50像素
Sleep, 300
Send {LButton}
Sleep, 300
Send {Enter}
Sleep, 300
Return
}
;--------------------------------------------------------------------------------------------------------------------------
;仅粘贴 右键+中键
~RButton & MButton::
{
Send ^v
Return
}
;鼠标第四、五个按钮实现翻页
XButton1::
{
Send {PgDn}
Return
}
XButton2::
{
Send {PgUp}
Return
}
;--------------------------------------------------------------------------------------------------------------------------
;参考: https://blog.csdn.net/liuyukuan/article/details/82757776
;说明: 这部分是针对Typora自动化办公的,里面一些加html标签的功能需要结合typora的DYZJ主题才能展现效果(到官网下)。
;功能: 输入一些快捷键就免去手敲html代码的过程
#IfWinActive ahk_exe C:\Program Files\Typora\Typora.exe ;限制活动窗口是Typora才有效
!r::QuoteSelection("<font color='red'>","</font>") ;alt+R 给选中的文本字体变红
return
!t::QuoteSelection("<font title='blue'>","</font>") ;alt+T 给选中的文本添加<font title='blue'>标签
return
!u::QuoteSelection("<span alt='underline'>","</span>") ;alt+U 给选中的文本添加<span alt='underline'>标签
return
!e::QuoteSelection("<span alt='emp'>","</span>") ;alt+E 给选中的文本添加<span alt='emp'>标签
return
!w::QuoteSelection("<span alt='wavy'>","</span>") ;alt+E 给选中的文本添加<span alt='emp'>标签
return
!'::QuoteSelection("""","""") ;alt+' 给选中的文本添加<span alt='emp'>标签
return
QuoteSelection(txt1,txt2)
{
selection:= GetSelection() ; Get selected text.
PasteText(Quote(selection,txt1,txt2)) ; Quote the text and paste it back.
}
GetSelection(timeoutSeconds:= 1)
{
Clipboard:= "" ; Clear clipboard for ClipWait to function.
Send ^c ; Send Ctrl+C to get selection on clipboard.
ClipWait %timeoutSeconds% ; Wait for the copied text to arrive at the clipboard.
return Clipboard
}
PasteText(s)
{
Clipboard:=s ; Put the text on the clipboard.
Send ^v ; Paste the text with Ctrl+V.
}
Quote(s,a,b)
{
return a s b
}
;热字串参数说明:
;——加*就无需终止符自动替换
;——加b0就无需把输入的退格
;——加R就发送原始替换文本
;——加?即使此热字串在另一个单词中也会被触发
:*b0?SI:<center::></center>{left 9}
return
:*b0?SI:<left::t></left>{left 7}
return
:*b0?SI:<right::></right>{left 8}
return
:*b0?SI:<span::></span>{left 7}
return
:*b0?SI:<font::></font>{left 7}
return
:*b0?:<img:: src='' style='box-shadow: #84a1a8 0px 10px 15px;zoom:100%'>{left 52}
return
:*b0SI?:<em>::</em>{left 5}
return
:*b0SI?:\o::verline{{}{}}{left 1} ;需要对{}转义
return
:*b0SI?:\r::ightarrow `
return
#If
;--------------------------------------------------------------------------------------------------------------------------
; 功能:一般情况下只能通过点击标题栏来拖动窗口.这个脚本可以在窗口中任何一点拖动窗口.要拖拽时点击按住 CapsLock 或鼠标中键然后拖动窗口到新的位置.
; 注意: ①在按下鼠标按钮后您可以释放 CapsLock 或鼠标中键,而不需要在整个拖动过程中按住它.
; ②此脚本需要 v1.0.25+.
~MButton & LButton::
CapsLock & LButton::
CoordMode, Mouse ; 切换到屏幕/绝对坐标.
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
if EWD_WinState = 0 ; 仅在窗口不处于最大化状态时
SetTimer, EWD_WatchMouse, 10 ; 在用户拖动时跟踪鼠标.
return
EWD_WatchMouse:
GetKeyState, EWD_LButtonState, LButton, P
if EWD_LButtonState = U ; 按钮已经释放, 所以拖动结束.
{
SetTimer, EWD_WatchMouse, Off
return
}
GetKeyState, EWD_EscapeState, Escape, P
if EWD_EscapeState = D ; 按下了 Escape, 所以取消拖动.
{
SetTimer, EWD_WatchMouse, Off
WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
return
}
; 否则, 改变窗口的位置以匹配
; 用户拖动鼠标引起的鼠标坐标变化:
CoordMode, Mouse
MouseGetPos, EWD_MouseX, EWD_MouseY
WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
SetWinDelay, -1 ; 让下面的移动更快速/平滑.
WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
EWD_MouseStartX := EWD_MouseX ; 为下一次调用此子程序进行更新.
EWD_MouseStartY := EWD_MouseY
return
;--------------------------------------------------------------------------------------------------------------------------
;功能: 屏幕取色器,win+c获取当前鼠标所在坐标对应的像素RGB值到剪切板
#c::
MouseGetPos, mouseX, mouseY
; 获得鼠标所在坐标,把鼠标的 X 坐标赋值给变量 mouseX ,同理 mouseY
PixelGetColor, color, %mouseX%, %mouseY%, RGB
; 调用 PixelGetColor 函数,获得鼠标所在坐标的 RGB 值,并赋值给 color
StringRight color,color,6
; 截取 color(第二个 color)右边的6个字符,因为获得的值是这样的:#RRGGBB,一般我们只需要 RRGGBB 部分。把截取到的值再赋给 color(第一个 color)。
clipboard = %color%
; 把 color 的值发送到剪贴板
return
;--------------------------------------------------------------------------------------------------------------------------
;功能:按下ALT+p复制当前选择的文件路径到剪切板
!p::
send ^c
sleep,200
clipboard=%clipboard% ;%null%
tooltip,%clipboard%
sleep,500
tooltip,
return
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/totalNie/my-ahk.git
git@gitee.com:totalNie/my-ahk.git
totalNie
my-ahk
AHK
master

搜索帮助