w-mousekey 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +55 -0
  4. package/.jsdoc +25 -0
  5. package/AutoHotkey_2.0.19/AutoHotkey.chm +0 -0
  6. package/AutoHotkey_2.0.19/AutoHotkey32.exe +0 -0
  7. package/AutoHotkey_2.0.19/AutoHotkey64.exe +0 -0
  8. package/AutoHotkey_2.0.19/Install.cmd +2 -0
  9. package/AutoHotkey_2.0.19/UX/Templates/Minimal for v2.ahk +6 -0
  10. package/AutoHotkey_2.0.19/UX/WindowSpy.ahk +246 -0
  11. package/AutoHotkey_2.0.19/UX/inc/CommandLineToArgs.ahk +12 -0
  12. package/AutoHotkey_2.0.19/UX/inc/CreateAppShortcut.ahk +37 -0
  13. package/AutoHotkey_2.0.19/UX/inc/EnableUIAccess.ahk +246 -0
  14. package/AutoHotkey_2.0.19/UX/inc/GetGitHubReleaseAssetURL.ahk +26 -0
  15. package/AutoHotkey_2.0.19/UX/inc/HashFile.ahk +96 -0
  16. package/AutoHotkey_2.0.19/UX/inc/README.txt +3 -0
  17. package/AutoHotkey_2.0.19/UX/inc/ShellRun.ahk +7 -0
  18. package/AutoHotkey_2.0.19/UX/inc/bounce-v1.ahk +3 -0
  19. package/AutoHotkey_2.0.19/UX/inc/common.ahk +21 -0
  20. package/AutoHotkey_2.0.19/UX/inc/config.ahk +13 -0
  21. package/AutoHotkey_2.0.19/UX/inc/identify.ahk +29 -0
  22. package/AutoHotkey_2.0.19/UX/inc/identify_regex.ahk +4 -0
  23. package/AutoHotkey_2.0.19/UX/inc/launcher-common.ahk +78 -0
  24. package/AutoHotkey_2.0.19/UX/inc/spy.ico +0 -0
  25. package/AutoHotkey_2.0.19/UX/inc/ui-base.ahk +129 -0
  26. package/AutoHotkey_2.0.19/UX/install-ahk2exe.ahk +53 -0
  27. package/AutoHotkey_2.0.19/UX/install-version.ahk +109 -0
  28. package/AutoHotkey_2.0.19/UX/install.ahk +1056 -0
  29. package/AutoHotkey_2.0.19/UX/launcher.ahk +430 -0
  30. package/AutoHotkey_2.0.19/UX/reload-v1.ahk +22 -0
  31. package/AutoHotkey_2.0.19/UX/reset-assoc.ahk +38 -0
  32. package/AutoHotkey_2.0.19/UX/ui-dash.ahk +200 -0
  33. package/AutoHotkey_2.0.19/UX/ui-editor.ahk +238 -0
  34. package/AutoHotkey_2.0.19/UX/ui-launcherconfig.ahk +195 -0
  35. package/AutoHotkey_2.0.19/UX/ui-newscript.ahk +296 -0
  36. package/AutoHotkey_2.0.19/UX/ui-setup.ahk +175 -0
  37. package/AutoHotkey_2.0.19/UX/ui-uninstall.ahk +68 -0
  38. package/AutoHotkey_2.0.19/WindowSpy.ahk +2 -0
  39. package/AutoHotkey_2.0.19/license.txt +351 -0
  40. package/AutoHotkey_2.0.19/zclick.ahk +5 -0
  41. package/AutoHotkey_2.0.19/zrun_click.bat +2 -0
  42. package/AutoHotkey_2.0.19/zrun_send.bat +2 -0
  43. package/AutoHotkey_2.0.19/zsend.ahk +4 -0
  44. package/LICENSE +21 -0
  45. package/README.md +23 -0
  46. package/SECURITY.md +5 -0
  47. package/_tmp/view.all.png +0 -0
  48. package/_tmp/view.det.png +0 -0
  49. package/babel.config.js +16 -0
  50. package/dist/action.umd.js +32 -0
  51. package/dist/action.umd.js.map +1 -0
  52. package/dist/ck-pic.umd.js +7 -0
  53. package/dist/ck-pic.umd.js.map +1 -0
  54. package/dist/compare.umd.js +7 -0
  55. package/dist/compare.umd.js.map +1 -0
  56. package/dist/get-settings.umd.js +7 -0
  57. package/dist/get-settings.umd.js.map +1 -0
  58. package/dist/mousekey.umd.js +7 -0
  59. package/dist/mousekey.umd.js.map +1 -0
  60. package/dist/screen.umd.js +7 -0
  61. package/dist/screen.umd.js.map +1 -0
  62. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  63. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  64. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  65. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  66. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  67. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  68. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  69. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  70. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  71. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  72. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  73. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  74. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  75. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  76. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  77. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  78. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  79. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  80. package/docs/index.html +84 -0
  81. package/docs/scripts/collapse.js +39 -0
  82. package/docs/scripts/commonNav.js +28 -0
  83. package/docs/scripts/linenumber.js +25 -0
  84. package/docs/scripts/nav.js +12 -0
  85. package/docs/scripts/polyfill.js +4 -0
  86. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  87. package/docs/scripts/prettify/lang-css.js +2 -0
  88. package/docs/scripts/prettify/prettify.js +28 -0
  89. package/docs/scripts/search.js +99 -0
  90. package/docs/styles/jsdoc.css +776 -0
  91. package/docs/styles/prettify.css +80 -0
  92. package/g.mjs +46 -0
  93. package/g.test_opencv.mjs +36 -0
  94. package/package.json +41 -0
  95. package/pic/view.png +0 -0
  96. package/script.txt +17 -0
  97. package/src/action.mjs +132 -0
  98. package/src/ckPic.mjs +95 -0
  99. package/src/compare.mjs +201 -0
  100. package/src/getSettings.mjs +17 -0
  101. package/src/mousekey.mjs +95 -0
  102. package/src/screen.mjs +62 -0
  103. package/test/WMousekey.test.mjs +11 -0
  104. package/toolg/addVersion.mjs +4 -0
  105. package/toolg/cleanFolder.mjs +4 -0
  106. package/toolg/gDistRollup.mjs +33 -0
  107. package/toolg/modifyReadme.mjs +4 -0
@@ -0,0 +1,26 @@
1
+ GetGitHubReleaseAssetURL(repo, ext:='.zip', release:='latest') {
2
+ req := ComObject('Msxml2.XMLHTTP')
3
+ req.open('GET', 'https://api.github.com/repos/' repo '/releases/' release, false)
4
+ req.send()
5
+ if req.status != 200
6
+ throw Error(req.status ' - ' req.statusText, -1)
7
+
8
+ res := JSON_parse(req.responseText)
9
+ try
10
+ assets := res.assets
11
+ catch PropertyError
12
+ throw Error(res.message, -1)
13
+
14
+ loop assets.length {
15
+ asset := assets.%A_Index-1%
16
+ if SubStr(asset.name, -StrLen(ext)) = ext {
17
+ return asset.browser_download_url
18
+ }
19
+ }
20
+
21
+ JSON_parse(str) {
22
+ htmlfile := ComObject('htmlfile')
23
+ htmlfile.write('<meta http-equiv="X-UA-Compatible" content="IE=edge">')
24
+ return htmlfile.parentWindow.JSON.parse(str)
25
+ }
26
+ }
@@ -0,0 +1,96 @@
1
+ ; HashFile by Deo
2
+ ; https://autohotkey.com/board/topic/66139-ahk-l-calculating-md5sha-checksum-from-file/
3
+ ; Modified for AutoHotkey v2 by lexikos.
4
+
5
+ #Requires AutoHotkey v2.0-beta
6
+
7
+ /*
8
+ HASH types:
9
+ 1 - MD2
10
+ 2 - MD5
11
+ 3 - SHA
12
+ 4 - SHA256
13
+ 5 - SHA384
14
+ 6 - SHA512
15
+ */
16
+ HashFile(filePath, hashType:=2)
17
+ {
18
+ static PROV_RSA_AES := 24
19
+ static CRYPT_VERIFYCONTEXT := 0xF0000000
20
+ static BUFF_SIZE := 1024 * 1024 ; 1 MB
21
+ static HP_HASHVAL := 0x0002
22
+ static HP_HASHSIZE := 0x0004
23
+
24
+ switch hashType {
25
+ case 1: hash_alg := (CALG_MD2 := 32769)
26
+ case 2: hash_alg := (CALG_MD5 := 32771)
27
+ case 3: hash_alg := (CALG_SHA := 32772)
28
+ case 4: hash_alg := (CALG_SHA_256 := 32780)
29
+ case 5: hash_alg := (CALG_SHA_384 := 32781)
30
+ case 6: hash_alg := (CALG_SHA_512 := 32782)
31
+ default: throw ValueError('Invalid hashType', -1, hashType)
32
+ }
33
+
34
+ f := FileOpen(filePath, "r")
35
+ f.Pos := 0 ; Rewind in case of BOM.
36
+
37
+ HCRYPTPROV() => {
38
+ ptr: 0,
39
+ __delete: this => this.ptr && DllCall("Advapi32\CryptReleaseContext", "Ptr", this, "UInt", 0)
40
+ }
41
+
42
+ if !DllCall("Advapi32\CryptAcquireContextW"
43
+ , "Ptr*", hProv := HCRYPTPROV()
44
+ , "Uint", 0
45
+ , "Uint", 0
46
+ , "Uint", PROV_RSA_AES
47
+ , "UInt", CRYPT_VERIFYCONTEXT)
48
+ throw OSError()
49
+
50
+ HCRYPTHASH() => {
51
+ ptr: 0,
52
+ __delete: this => this.ptr && DllCall("Advapi32\CryptDestroyHash", "Ptr", this)
53
+ }
54
+
55
+ if !DllCall("Advapi32\CryptCreateHash"
56
+ , "Ptr", hProv
57
+ , "Uint", hash_alg
58
+ , "Uint", 0
59
+ , "Uint", 0
60
+ , "Ptr*", hHash := HCRYPTHASH())
61
+ throw OSError()
62
+
63
+ read_buf := Buffer(BUFF_SIZE, 0)
64
+
65
+ While (cbCount := f.RawRead(read_buf, BUFF_SIZE))
66
+ {
67
+ if !DllCall("Advapi32\CryptHashData"
68
+ , "Ptr", hHash
69
+ , "Ptr", read_buf
70
+ , "Uint", cbCount
71
+ , "Uint", 0)
72
+ throw OSError()
73
+ }
74
+
75
+ if !DllCall("Advapi32\CryptGetHashParam"
76
+ , "Ptr", hHash
77
+ , "Uint", HP_HASHSIZE
78
+ , "Uint*", &HashLen := 0
79
+ , "Uint*", &HashLenSize := 4
80
+ , "UInt", 0)
81
+ throw OSError()
82
+
83
+ bHash := Buffer(HashLen, 0)
84
+ if !DllCall("Advapi32\CryptGetHashParam"
85
+ , "Ptr", hHash
86
+ , "Uint", HP_HASHVAL
87
+ , "Ptr", bHash
88
+ , "Uint*", &HashLen
89
+ , "UInt", 0 )
90
+ throw OSError()
91
+
92
+ loop HashLen
93
+ HashVal .= Format('{:02x}', (NumGet(bHash, A_Index-1, "UChar")) & 0xff)
94
+
95
+ return HashVal
96
+ }
@@ -0,0 +1,3 @@
1
+ Scripts in this directory may be copied and used freely, but
2
+ may be removed or modified without notice by any future release.
3
+ Do not #include them directly; instead, create a copy.
@@ -0,0 +1,7 @@
1
+ ; For documentation about the parameters, refer to:
2
+ ; https://learn.microsoft.com/en-us/windows/win32/shell/shell-shellexecute
3
+ ShellRun(filePath, arguments?, directory?, operation?, show?) {
4
+ static VT_UI4 := 0x13, SWC_DESKTOP := ComValue(VT_UI4, 0x8)
5
+ ComObject("Shell.Application").Windows.Item(SWC_DESKTOP).Document.Application
6
+ .ShellExecute(filePath, arguments?, directory?, operation?, show?)
7
+ }
@@ -0,0 +1,3 @@
1
+ ; v1: includes the file from the script's directory.
2
+ ; v2: does nothing because the path is relative to this file.
3
+ #include *i reload-v1.ahk
@@ -0,0 +1,21 @@
1
+ A_AllowMainWindow := true
2
+ if A_AhkPath != A_ScriptDir '\AutoHotkeyUX.exe' {
3
+ ; Standalone, compiled or test mode: locate InstallDir via registry
4
+ DirExist(ROOT_DIR := RegRead('HKCU\SOFTWARE\AutoHotkey', 'InstallDir', ""))
5
+ || (ROOT_DIR := RegRead('HKLM\SOFTWARE\AutoHotkey', 'InstallDir', ""))
6
+ }
7
+ if (ROOT_DIR ?? "") = "" || !DirExist(ROOT_DIR)
8
+ Loop Files A_ScriptDir '\..', 'D'
9
+ ROOT_DIR := A_LoopFileFullPath
10
+
11
+ if !trace.Enabled := RegRead('HKCU\Software\AutoHotkey', 'Trace', false)
12
+ trace.DefineProp 'call', {call: (*) => ''}
13
+
14
+ #include config.ahk
15
+
16
+ trace(s) {
17
+ try
18
+ FileAppend s "`n", "*"
19
+ catch
20
+ OutputDebug s "`n"
21
+ }
@@ -0,0 +1,13 @@
1
+
2
+ ; CONFIG_FILE_PATH := A_MyDocuments "\AutoHotkey\AutoHotkey.ini"
3
+ CONFIG_KEY := 'HKCU\Software\AutoHotkey'
4
+
5
+ ConfigRead(section, key, default) {
6
+ ; return IniRead(CONFIG_FILE_PATH, section, key, default)
7
+ return RegRead(CONFIG_KEY '\' section, key, default)
8
+ }
9
+
10
+ ConfigWrite(value, section, key) {
11
+ ; IniWrite(value, CONFIG_FILE_PATH, section, key)
12
+ RegWrite(value, 'REG_SZ', CONFIG_KEY '\' section, key)
13
+ }
@@ -0,0 +1,29 @@
1
+ #include identify_regex.ahk
2
+
3
+ IdentifyBySyntax(code) {
4
+ static identify_regex := get_identify_regex()
5
+ p := 1, count_1 := count_2 := 0, version := marks := ''
6
+ try while (p := RegExMatch(code, identify_regex, &m, p)) {
7
+ p += m.Len()
8
+ if SubStr(m.mark,1,1) = 'v' {
9
+ switch SubStr(m.mark,2,1) {
10
+ case '1': count_1++
11
+ case '2': count_2++
12
+ }
13
+ if !InStr(marks, m.mark)
14
+ marks .= m.mark ' '
15
+ }
16
+ }
17
+ catch as e
18
+ return {v: 0, r: "error", err: e, pos: p}
19
+ if !(count_1 || count_2)
20
+ return {v: 0, r: "no tell-tale matches"}
21
+ ; Use a simple, cautious approach for now: select a version only if there were
22
+ ; matches for exactly one version.
23
+ if count_1 && count_2
24
+ return {v: 0, r: Format(
25
+ count_1 > count_2 ? "v1 {1}:{2} - {3}" : count_2 > count_1 ? "v2 {2}:{1} - {3}" : "? {1}:{2} - {3}",
26
+ count_1, count_2, Trim(marks)
27
+ )}
28
+ return {v: count_1 ? 1 : 2, r: Trim(marks)}
29
+ }
@@ -0,0 +1,4 @@
1
+ get_identify_regex() => '
2
+ (
3
+ (?(DEFINE)(?<line_comment>(?<![^ `t`r`n]);.*)(?<block_comment>(?m:^[ `t]*/\*(?:.*\R?)+?(?:[ `t]*\*/|.*\Z)))(?<eol>(?=[ `t]*+(?&line_comment)?(?m:$)))(?<tosol>(?:(?&eol).*\R|(?&block_comment))++)(?<toeol>(?:[^ `t`r`n]++|[ `t]*+(?!(?&eol)))*+)(?<contsec>[ `t]*+\((?i:Join[^ `t`r`n]*+|(?&line_comment)|[^ `t`r`n()]++|[ `t]++)*+\R(?:[ `t]*+(?!\)).*\R)*+[ `t]*+\))(?<solcont>[ `t]*+(?:,(?!::| +& )|[<>=/|^,?:\.+\-*&!~](?![^"'`r`n]*?(?:".*?::(?!.*?")|'.*?::(?!.*?')|::))|(?i:AND|OR)(?=[ `t])))(?<eolcont>(?&eol)(?:(?<ec_bad>(?<=:=)|(?<=[:,]))|(?<=[<>=/|^,?:\.+\-*&!~](?<!\+\+|--))|(?<=(?<![\w[:^ascii:]\.])(?i:OR|IS|AS|IN))|(?<=(?<![\w[:^ascii:]\.])(?i:AND|NOT))|(?<=(?<![\w[:^ascii:]\.])(?i:CONTAINS)))(?&tosol)(?:(?&contsec)|(?(ec_bad)|(*:v2-cle))))(?<v1_cont>(?&tosol)(?:(?&solcont)(?&subexp)|[ `t]*+,[ `t]*+(?=%)(?&pct)|(?&contsec)(?&ambig)))(?<v1_fin>(?:.*+(?&v1_cont))*.*+)(?<ambig>(?:(?&exp)|(?&v1_cont)|.*+)++(*:~))(?<pct>(?=%[ `t])(?:(?&subexp)(?&exp)|(?&v1_fin)(*:v1-pct)))(?<expm>(*:exp)(?&exp))(?<v1_lines>(?&toeol)(?:(?&tosol)(?:(?&solcont)|(?&contsec))(?&v1_lines))?)(?<otb>(?<![<>=/|^,?:\.*&!~])(?<!(?<!\+)\+)(?<!(?<!\-)\-)[ `t]*+\{(?&eol))(?<enclf>\R(?:(?&contsec)|(?!(?&solcont))(*:v2-cbe)|))(?<encex>(?:[, `t]++|(?&enclf)|(?&subexp)|(?&line_comment))*+)(?<v2_exm>%(?:[^,`r`n;\[\]{}()"%']*+|,(?![ `t]*+%)|(?&subexp))*+%(*:v2-pct)|=>(*:v2-fat))(?<subexp>(?:(?!(?&otb))(?&eolcont)?[ `t]*+(?:[^ `t;,`r`n=\[\]{}()"%']++|\((?&encex)\)|\[(?&encex)\]|\{(?&encex)\}|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq))|'(?&tosol)(?&contsec)'(*:v2-sq)|(?<!\.)%[\w[:^ascii:]]++%|(?&v2_exm)|=|(?&v1_cont)))++)(?<exp>(?:(?&subexp)|[ `t]*+,|(?&eol))++(?&otb)?))(?:[ `t]*+(?&line_comment)(*SKIP)(?!)|(?m:^)[ `t{}]*(?:(?m:^[ `t]*/\*(?:.*\R?)+?(?:[ `t]*\*/|.*\Z))(*SKIP)(?!)|(?:[<>*~$!^+#]*(?>\w+|[^ `t`r`n])|~?(?>\w+|[^ `t`r`n]) & ~?(?>\w+|[^ `t`r`n]))(?i:[ `t]+up)?::(?:[<>*~$!^+#]*(?>\w+|[^ `t`r`n])(?&eol)(*:remap?)|(?&eol)(?!(?&tosol)[ `t]*+(?:[\{#]|.*?::|[\w[:^ascii:]]++\())(*:v1-hk)|(*:hotkey))|(?(?=:[^\:`r`n]*[xX]):[[:alnum:]\?\*\- ]*:([^```r`n:]++|``.|:(?!:))*?::|:[[:alnum:]\?\*\- ]*:([^```r`n:]++|``.|:(?!:))*?::(?:(?&v1_cont)|.*))(*:hotstring)|[\w[:^ascii:]]++:(?=[ `t]*+(?:(?<![^ `t`r`n]);.*)?(?m:$))(*:label)|[^ ,```r`n]+(?<!:):(?=[ `t]*+(?:(?<![^ `t`r`n]);.*)?(?m:$))(*:v1-lbl)|#(?:\w+,|(?i:NoEnv|If|CommentFlag|Delimiter|DerefChar|EscapeChar))(?&v1_fin)(*:v1-dir)|#(?i:HotIf)(*:v2-dir)(?&exp)?|#(?i:Include(?:Again)?)[ `t]+(?&v1_fin)(*:dir)|#\w+(?![^ `t`r`n])(?&ambig)(*:dir?)|(?<=[{}])(*SKIP)(?!))|[ `t]*+(?:(?!(?:[\w[:^ascii:]<>=/|^,?:\.+\-*&!~ `t()\[\]{}%]++|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq))|['"].*)*+(?=[ `t]*+(?:(?<![^ `t`r`n]);.*)?(?m:$)))(?&v1_fin)(*:v1-char)|(?i:else|try|finally)(?![^ `t`r`n])[ `t]*+\{?(*SKIP)(?!)|(?i:return|for|while|until|throw|switch)[ `t]++(?&expm)|(?i:if|while|return|until|loop|goto)(?=\()(?&expm)|(?i:local|global|static)(?![\w[:^ascii:]#@$])(?:[ `t]++[\w[:^ascii:]]++(?:(?=\()(?&exp)(*:v2-kw)|[ `t]*+\{(?&eol)(*:v2-kw)|(?![ `t]*+=)(?&expm))|(?&eol)(*:assume)|(?&v1_fin)(*:v1-kw))|(?i:if)[ `t]++(?:(?>[\w[:^ascii:]#@$]++|%[\w[:^ascii:]#@$]++%)++(?:[ `t]++(?i:not[ `t]++)?(?i:in|contains|between)[ `t]++(?&v1_fin)(*:v1-if)|[ `t]*+(?:[<>]=?|!?=)(?&ambig))|(?&expm))|[\w[:^ascii:]]++(?:[ `t]*+=(?:>(?&ambig)|.*?\?.+?:.*(?&ambig)|(?&v1_fin)(*:v1-ass))|[\(\[](?=.*[\)\]][ `t`r`n]*\{)(?:[ `t]*+[\w[:^ascii:]]++[ `t]*+(?::=(?&subexp))?[ `t]*+,)*+[ `t]*+(?:(?i:ByRef)[ `t]++[\w[:^ascii:]](*:v1-ref)|&(*:v2-ref)|[\w[:^ascii:]]++[ `t]*+=(*:v1-def)|\*[ `t]*+[\)\]](*:v2-vfn)).*|(?=[\(\[\.\?]|[ `t]*+(?>[\:\+\-\*/\.\|&\^]|<<|>>|//)=)(?&expm)|,(?&v1_fin)(*:v1-cmd)|(?&eol)(?&ambig)|[ `t]++(?:[ `t]*+(?:\^|(?:(?!\{)[\w[:^ascii:]<>=/|^,?:\.+\-*&!~ `t()\[\]{}%]|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq)))*+\{[ `t]*+(?:\w+|.)(?:[ `t]++\w+)?[ `t]*+\})(?&v1_fin)(*:v1-send)|(?:[^`r`n,\[\]{}()"%']*+,[ `t]*+)*+(?&pct)|(?&ambig)(*:cmd?)))|(?:\+\+|--)(?&expm)|.(?&ambig)(*:!!)))
4
+ )'
@@ -0,0 +1,78 @@
1
+
2
+ #include common.ahk
3
+
4
+ GetExeInfo(exe) {
5
+ if !(verSize := DllCall("version\GetFileVersionInfoSize", "str", exe, "uint*", 0, "uint"))
6
+ || !DllCall("version\GetFileVersionInfo", "str", exe, "uint", 0, "uint", verSize, "ptr", verInfo := Buffer(verSize))
7
+ throw OSError()
8
+ prop := {Path: exe}
9
+ static Properties := {
10
+ Version: 'FileVersion',
11
+ Description: 'FileDescription',
12
+ ProductName: 'ProductName'
13
+ }
14
+ for propName, infoName in Properties.OwnProps()
15
+ if DllCall("version\VerQueryValue", "ptr", verInfo, "str", "\StringFileInfo\040904b0\" infoName, "ptr*", &p:=0, "uint*", &len:=0)
16
+ prop.%propName% := StrGet(p, len)
17
+ else throw OSError()
18
+ if InStr(exe, '_UIA')
19
+ prop.Description .= ' UIA'
20
+ prop.Version := RegExReplace(prop.Version, 'i)-[a-z]{4,}\K(?=\d)|, ', '.') ; Hack-fix for erroneous version numbers (AutoHotkey_H v2.0-beta3-H...)
21
+ return prop
22
+ }
23
+
24
+ IsUsableAutoHotkey(exeinfo) {
25
+ return exeinfo.HasProp('Description')
26
+ && RegExMatch(exeinfo.Description, '^AutoHotkey.* (32|64)-bit', &m)
27
+ && (m.1 != '64' || A_Is64bitOS)
28
+ && !InStr(exeinfo.Path, '\AutoHotkeyUX.exe')
29
+ }
30
+
31
+ GetMajor(v) {
32
+ Loop Parse, v, '.-+'
33
+ return Integer(A_LoopField)
34
+ throw ValueError('Invalid version number', -1, v)
35
+ }
36
+
37
+ ReadHashes(path, filter?) {
38
+ filemap := Map(), filemap.CaseSense := 0
39
+ if !FileExist(path)
40
+ return filemap
41
+ csvfile := FileOpen(path, 'r')
42
+ props := StrSplit(csvfile.ReadLine(), ',')
43
+ while !csvfile.AtEOF {
44
+ item := {}
45
+ Loop Parse csvfile.ReadLine(), 'CSV'
46
+ item.%props[A_Index]% := A_LoopField
47
+ if IsSet(filter) && !filter(item)
48
+ continue
49
+ filemap[item.Path] := item
50
+ }
51
+ return filemap
52
+ }
53
+
54
+ GetUsableAutoHotkeyExes() {
55
+ static files
56
+ if IsSet(files) {
57
+ trace '![Launcher] returning hashes again'
58
+ return files
59
+ }
60
+ files := ReadHashes(ROOT_DIR '\UX\installed-files.csv',
61
+ item => IsUsableAutoHotkey(item) && (
62
+ item.Path ~= '^(?!\w:|\\\\)' && item.Path := ROOT_DIR '\' item.Path,
63
+ true
64
+ ))
65
+ if files.Count {
66
+ trace '![Launcher] returning hashes from cache'
67
+ return files
68
+ }
69
+ Loop Files ROOT_DIR '\AutoHotkey*.exe', 'R' {
70
+ try {
71
+ item := GetExeInfo(A_LoopFilePath)
72
+ if IsUsableAutoHotkey(item)
73
+ files[item.Path] := item
74
+ }
75
+ }
76
+ trace '![Launcher] returning hashes from filesystem'
77
+ return files
78
+ }
Binary file
@@ -0,0 +1,129 @@
1
+ class AutoHotkeyUxGui extends Gui {
2
+ __new(title, opt:='') {
3
+ super.__new(opt, title, this)
4
+ this.SetFont('s9', "Segoe UI")
5
+ this.OnEvent('Escape', 'Destroy')
6
+ this.OnEvent('Close', 'Destroy')
7
+ }
8
+
9
+ AddListMenu(options:='', columns:=unset) {
10
+ IsSet(columns) || columns := []
11
+ c := this.AddListView(UxListMenu.DefaultOptions ' ' options, columns)
12
+ if !InStr(options, 'Theme')
13
+ DllCall("uxtheme\SetWindowTheme", "ptr", c.hwnd, "wstr", "Explorer", "ptr", 0)
14
+ static LVTVIM_TILESIZE := 1, LVTVIM_COLUMNS := 2, LVTVIM_LABELMARGIN := 4
15
+ static LVTVIF_AUTOSIZE := 0, LVTVIF_EXTENDED := 4, LVTVIF_FIXEDHEIGHT := 2
16
+ , LVTVIF_FIXEDSIZE := 3, LVTVIF_FIXEDWIDTH := 1
17
+ static LVM_SETTILEVIEWINFO := 0x10A2
18
+ tileviewinfo := Buffer(40, 0)
19
+ ControlGetPos(,, &w,, c)
20
+ pad := 2 * A_ScreenDPI // 96
21
+ NumPut(
22
+ 'uint', 40, ; cbSize
23
+ 'uint', LVTVIM_LABELMARGIN | LVTVIM_TILESIZE, ; dwMask
24
+ 'uint', LVTVIF_FIXEDWIDTH, ; dwFlags
25
+ 'int', w, 'int', 0, ; sizeTile
26
+ 'int', 0, ; cLines
27
+ 'int', pad, 'int', pad, 'int', pad, 'int', pad, ; rcLabelMargin
28
+ tileviewinfo
29
+ )
30
+ SendMessage LVM_SETTILEVIEWINFO,, tileviewinfo, c
31
+ c.base := UxListMenu.Prototype
32
+ return c
33
+ }
34
+
35
+ AddIconButton(options, iconHandle, hiddenText:="") {
36
+ static BS_ICON := 0x40
37
+ static BS_CENTER := 0x300
38
+ static BS_VCENTER := 0xC00
39
+ btn := this.AddButton((BS_ICON | BS_CENTER | BS_VCENTER) ' ' options, hiddenText)
40
+ static BM_SETIMAGE := 0xF7
41
+ SendMessage(BM_SETIMAGE, 1, iconHandle, btn)
42
+ return btn
43
+ }
44
+
45
+ FileSelect(p*) {
46
+ this.Opt '+OwnDialogs'
47
+ try
48
+ return FileSelect(p*)
49
+ finally
50
+ this.Opt '-OwnDialogs'
51
+ }
52
+
53
+ static Show(p*) {
54
+ for w in WinGetList('ahk_pid ' ProcessExist())
55
+ if (g := GuiFromHwnd(w)) && g.base = this.Prototype
56
+ return g.Show()
57
+ inst := this(p*)
58
+ inst.Show()
59
+ }
60
+ }
61
+
62
+ class UxListMenu extends Gui.ListView {
63
+ static DefaultOptions := '-Multi Tile'
64
+ . ' R1'
65
+ . ' -E0x200' ; -WS_EX_CLIENTEDGE (remove border)
66
+ . ' LV0x14000'
67
+ . Format(' Background{:x}', DllCall("GetSysColor", "int", 15, "int")) ; COLOR_3DFACE
68
+
69
+ Add(p*) {
70
+ i := super.Add(p*)
71
+ static LVM_SETTILEINFO := 0x10A4
72
+ static LVCFMT_FILL := 0x200000
73
+ static LVCFMT_WRAP := 0x400000
74
+ tileinfo := Buffer(8 + 3*A_PtrSize, 0)
75
+ col := Buffer(4)
76
+ colf := Buffer(4)
77
+ NumPut("int", 1, col)
78
+ NumPut("int", LVCFMT_FILL | LVCFMT_WRAP, colf)
79
+ NumPut("int", tileinfo.size, "int", i-1, "uptr", 1, "ptr", col.ptr, "ptr", colf.ptr, tileinfo)
80
+ SendMessage(LVM_SETTILEINFO, 0, tileinfo, this)
81
+ return i
82
+ }
83
+
84
+ _SetTileWidth(w) {
85
+ static LVTVIM_TILESIZE := 1, LVTVIM_COLUMNS := 2, LVTVIM_LABELMARGIN := 4
86
+ static LVTVIF_AUTOSIZE := 0, LVTVIF_EXTENDED := 4, LVTVIF_FIXEDHEIGHT := 2
87
+ , LVTVIF_FIXEDSIZE := 3, LVTVIF_FIXEDWIDTH := 1
88
+ static LVM_SETTILEVIEWINFO := 0x10A2
89
+ tileviewinfo := Buffer(40, 0)
90
+ pad := 2 * A_ScreenDPI // 96
91
+ NumPut(
92
+ 'uint', 40, ; cbSize
93
+ 'uint', LVTVIM_LABELMARGIN | LVTVIM_TILESIZE, ; dwMask
94
+ 'uint', LVTVIF_FIXEDWIDTH, ; dwFlags
95
+ 'int', w, 'int', 0, ; sizeTile
96
+ 'int', 0, ; cLines
97
+ 'int', pad, 'int', pad, 'int', pad, 'int', pad, ; rcLabelMargin
98
+ tileviewinfo
99
+ )
100
+ SendMessage LVM_SETTILEVIEWINFO,, tileviewinfo, this
101
+ }
102
+
103
+ AutoSize(maxItems:=20) {
104
+ static LVM_GETITEMRECT := 0x100E, LVIR_BOUNDS := 0
105
+ static SM_CXVSCROLL := 2
106
+
107
+ itemCount := this.GetCount()
108
+
109
+ ; Keep control width and adjust tile width to avoid horizontal scrollbar.
110
+ ControlGetPos(,, &w,, this)
111
+ if itemCount > maxItems
112
+ w -= SysGet(SM_CXVSCROLL)
113
+ this._SetTileWidth(w)
114
+
115
+ ; Adjust control height to fit content.
116
+ rect := Buffer(16, 0)
117
+ NumPut('int', LVIR_BOUNDS, rect)
118
+ SendMessage(LVM_GETITEMRECT, Min(itemCount, maxItems) - 1, rect.ptr, this)
119
+ iy := NumGet(rect, 4, 'int')
120
+ iw := NumGet(rect, 8, 'int')
121
+ ih := NumGet(rect, 12, 'int') - iy
122
+ ; Result needs additional padding. Testing showed the width returned was less
123
+ ; than what we set with LVM_SETTILEVIEWINFO. The amount of padding needed to
124
+ ; avoid scrollbars appeared to be exactly the amount to bring it up to the size
125
+ ; we specified, so perhaps something similar is happening with the height.
126
+ h := NumGet(rect, 12, 'int') + 4
127
+ ControlMove(,,, h, this)
128
+ }
129
+ }
@@ -0,0 +1,53 @@
1
+ ; Run this script to launch or download and install Ahk2Exe into A_ScriptDir '\..\Compiler'.
2
+ #requires AutoHotkey v2.0
3
+
4
+ #include install.ahk
5
+ #include inc\GetGitHubReleaseAssetURL.ahk
6
+
7
+ #SingleInstance Force
8
+ InstallAhk2Exe
9
+
10
+ InstallAhk2Exe() {
11
+ inst := Installation()
12
+ inst.ResolveInstallDir() ; This sets inst.InstallDir and inst.UserInstall
13
+
14
+ finalPath := inst.InstallDir '\Compiler\Ahk2Exe.exe'
15
+ if FileExist(finalPath) {
16
+ ShellRun finalPath
17
+ ExitApp
18
+ }
19
+
20
+ if !A_Args.Length {
21
+ (inst.UserInstall) || SetTimer(() => (
22
+ WinExist('ahk_class #32770 ahk_pid ' ProcessExist()) &&
23
+ SendMessage(0x160C,, true, 'Button1') ; BCM_SETSHIELD := 0x160C
24
+ ), -25)
25
+ if MsgBox("Ahk2Exe is not installed, but we can download and install it for you.", "AutoHotkey", 'OkCancel') = 'Cancel'
26
+ ExitApp
27
+ if !A_IsAdmin && !inst.UserInstall {
28
+ Run Format('*RunAs "{1}" /restart /script "{2}" /Y', A_AhkPath, A_ScriptFullPath)
29
+ ExitApp
30
+ }
31
+ }
32
+
33
+ tempDir := A_ScriptDir '\.staging' ; Avoid A_Temp for security reasons
34
+ DirCreate tempDir
35
+ SetWorkingDir tempDir
36
+
37
+ TrayTip "Downloading Ahk2Exe", "AutoHotkey"
38
+ url := GetGitHubReleaseAssetURL('AutoHotkey/Ahk2Exe')
39
+ Download url, 'Ahk2Exe.zip'
40
+
41
+ TrayTip "Installing Ahk2Exe", "AutoHotkey"
42
+ DirCopy 'Ahk2Exe.zip', 'Compiler', true
43
+ FileDelete 'Ahk2Exe.zip'
44
+
45
+ inst.AddCompiler(tempDir '\Compiler')
46
+ inst.Apply()
47
+
48
+ ; Working dir may have been changed
49
+ DirDelete tempDir '\Compiler', true
50
+ DirDelete tempDir
51
+
52
+ ShellRun finalPath
53
+ }
@@ -0,0 +1,109 @@
1
+ ; Run this script to download and install an additional AutoHotkey version.
2
+ ; Specify the version as a single command line parameter. If omitted or
3
+ ; incomplete like "1.1" or "2.0", the latest version will be downloaded.
4
+ #requires AutoHotkey v2.0
5
+
6
+ #include install.ahk
7
+
8
+ A_ScriptName := "AutoHotkey"
9
+
10
+ InstallAutoHotkey A_Args.Length ? A_Args[1] : '1.1'
11
+
12
+ InstallAutoHotkey(version) {
13
+ abort(message, extra?) {
14
+ if IsSet(extra)
15
+ message .= "`n`nSpecifically: " SubStr(extra, 1, 100)
16
+ MsgBox message,, "Iconx"
17
+ ExitApp
18
+ }
19
+
20
+ ; Determine base version, for download directory
21
+ baseVersion := RegExReplace(version, '^\d+(?:\.\d+)?\b\K.*')
22
+ if IsInteger(baseVersion)
23
+ baseVersion .= baseVersion = '1' ? '.1' : '.0'
24
+ else if !IsNumber(baseVersion)
25
+ abort "Invalid version.", version
26
+
27
+ ; If version number is not exact, try to determine the latest compatible version
28
+ if IsNumber(version) {
29
+ url := Format('https://www.autohotkey.com/download/{}/version.txt', baseVersion)
30
+ req := ComObject('Msxml2.XMLHTTP')
31
+ req.open('GET', url, false)
32
+ req.send()
33
+ if req.status != 200
34
+ throw Error(req.status ' - ' req.statusText, -1)
35
+ currentVersion := req.responseText
36
+ if !(currentVersion ~= '^\Q' baseVersion '\E\b')
37
+ abort "An error occurred while trying to identify the latest available version. The downloaded version.txt was invalid.", currentVersion
38
+ version := currentVersion
39
+ }
40
+
41
+ ; Only versions for which a zip is available are supported by this script.
42
+ ; 1.1.00.00 - 1.1.22.06 have no downloads available at the time of writing.
43
+ ; 1.1.22.07 - 1.1.24.01 have one zip per exe.
44
+ if VerCompare(version, '1.1') >= 0 && VerCompare(version, '1.1.24.02') < 0
45
+ abort "This version cannot be installed automatically.", version
46
+
47
+ inst := Installation()
48
+ inst.ResolveInstallDir()
49
+
50
+ if A_Args.Length < 2 && !A_IsAdmin && !inst.UserInstall {
51
+ ExitApp RunWait(Format('*RunAs "{1}" /force /script "{2}" {3} /Y', A_AhkPath, A_ScriptFullPath, version))
52
+ }
53
+
54
+ zipName := VerCompare(version, '1.1.24.02') < 0
55
+ ? 'AutoHotkey' StrReplace(version, '.') '.zip'
56
+ : 'AutoHotkey_' version '.zip'
57
+ url := Format('https://www.autohotkey.com/download/{}/{}', baseVersion, zipName)
58
+
59
+ try {
60
+ tempDir := inst.InstallDir '\.staging' ; Avoid A_Temp for security reasons
61
+ try {
62
+ DirCreate tempDir
63
+ SetWorkingDir tempDir
64
+ }
65
+ catch OSError as e
66
+ abort "An error occured while preparing the temporary directory.", e.Message
67
+
68
+ TrayTip "Downloading AutoHotkey v" version, "AutoHotkey"
69
+ try
70
+ Download url, tempDir '\' zipName
71
+ catch
72
+ abort "Download failed.`n`nURL: " url
73
+
74
+ TrayTip "Installing AutoHotkey v" version, "AutoHotkey"
75
+ inst.SourceDir := tempDir '\v' version
76
+ try
77
+ DirCopy tempDir '\' zipName, inst.SourceDir, true
78
+ catch
79
+ abort "Extraction failed."
80
+ finally
81
+ try
82
+ FileDelete zipName
83
+ catch
84
+ MsgBox 'Unable to delete temporary file "' tempDir '\' zipName '".',, "Icon!"
85
+
86
+ try localUX := inst.Hashes['UX\install.ahk']
87
+ catch
88
+ localUX := {Version: ''}
89
+ try {
90
+ if VerCompare(localUX.Version, version) < 0
91
+ && FileExist(inst.SourceDir '\UX\install.ahk')
92
+ && FileExist(inst.SourceDir '\AutoHotkey32.exe') {
93
+ Run Format('"{1}\AutoHotkey32.exe" UX\install.ahk /to "{2}"', inst.SourceDir, inst.InstallDir), inst.SourceDir
94
+ ExitApp
95
+ }
96
+ else
97
+ inst.InstallExtraVersion
98
+ }
99
+ catch as e
100
+ abort "An error occurred during installation.", e.Message
101
+ }
102
+ finally {
103
+ try DirDelete tempDir '\v' version, true
104
+ try DirDelete tempDir
105
+ }
106
+
107
+ TrayTip
108
+ MsgBox "AutoHotkey v" version " is now installed."
109
+ }