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,95 @@
1
+ import path from 'path'
2
+ import { execFile } from 'child_process'
3
+ import { promisify } from 'util'
4
+ import fsIsFile from 'wsemi/src/fsIsFile.mjs'
5
+ import genPm from 'wsemi/src/genPm.mjs'
6
+
7
+
8
+ //execFileAsync
9
+ let execFileAsync = promisify(execFile)
10
+
11
+ //fdSrv
12
+ let fdSrv = path.resolve()
13
+
14
+ //fnExe
15
+ let fnExe = 'AutoHotkey64.exe'
16
+ let fdExe = ''
17
+ if (true) {
18
+ let fdExeSrc = `${fdSrv}/AutoHotkey_2.0.19/`
19
+ let fdExeNM = `${fdSrv}/node_modules/w-mousekey/AutoHotkey_2.0.19/`
20
+ if (fsIsFile(`${fdExeSrc}${fnExe}`)) {
21
+ fdExe = fdExeSrc
22
+ }
23
+ else if (fsIsFile(`${fdExeNM}${fnExe}`)) {
24
+ fdExe = fdExeNM
25
+ }
26
+ else {
27
+ throw new Error('can not find folder for AutoHotkey')
28
+ }
29
+ }
30
+ // console.log('fdExe', fdExe)
31
+
32
+ //AutoHotkey, 於windows直接下載免安裝檔調用
33
+ //https://www.autohotkey.com/download/
34
+ let ahkExePath = `${fdExe}/AutoHotkey64.exe` //path.resolve('./AutoHotkey_2.0.19/AutoHotkey64.exe')
35
+ let ahkScriptPathClick = `${fdExe}/zclick.ahk` //path.resolve('./AutoHotkey_2.0.19/zclick.ahk')
36
+ let ahkScriptPathSend = `${fdExe}/zsend.ahk` //path.resolve('./AutoHotkey_2.0.19/zsend.ahk')
37
+
38
+ async function runAhkScript(ahkExePath, ahkScriptPath, args = []) {
39
+ let pm = genPm()
40
+
41
+ try {
42
+ let { stdout, stderr } = await execFileAsync(ahkExePath, ['/force', ahkScriptPath, ...args])
43
+ if (stderr) {
44
+ // console.error('AHK error', stderr);
45
+ pm.reject(stderr)
46
+ }
47
+ else {
48
+ // console.log('AHK success', stdout);
49
+ pm.resolve(stdout)
50
+ }
51
+ }
52
+ catch (err) {
53
+ // console.error('AHK error', err);
54
+ pm.reject(err)
55
+ }
56
+
57
+ return pm
58
+ }
59
+
60
+ async function mouseClick(x, y) {
61
+ await runAhkScript(ahkExePath, ahkScriptPathClick, [x, y])
62
+ }
63
+
64
+ // async function mouseDown(x, y) {
65
+ // }
66
+
67
+ // async function mouseUp(x, y) {
68
+ // }
69
+
70
+ // async function keyDown(char) {
71
+ // }
72
+
73
+ // async function keyUp(char) {
74
+ // }
75
+
76
+ async function sendKey(char) {
77
+ await runAhkScript(ahkExePath, ahkScriptPathSend, [`${char}`])
78
+ }
79
+
80
+ async function sendString(str) {
81
+ await runAhkScript(ahkExePath, ahkScriptPathSend, [`${str}`])
82
+ }
83
+
84
+ let obj = {
85
+ // mouseDown,
86
+ // mouseUp,
87
+ mouseClick,
88
+ // keyDown,
89
+ // keyUp,
90
+ sendKey,
91
+ sendString,
92
+ }
93
+
94
+
95
+ export default obj
package/src/screen.mjs ADDED
@@ -0,0 +1,62 @@
1
+ import fs from 'fs'
2
+ import screenshot from 'screenshot-desktop'
3
+ import sharp from 'sharp'
4
+
5
+
6
+ async function screenFull() {
7
+
8
+ //screenshot
9
+ let img = await screenshot({ format: 'png' })
10
+
11
+ return img
12
+ }
13
+
14
+ async function screen(x, y, width, height) {
15
+
16
+ //screenshot
17
+ let img = await screenshot({ format: 'png' })
18
+
19
+ //cut
20
+ let buffer = await sharp(img)
21
+ .extract({ left: x, top: y, width, height })
22
+ .toBuffer()
23
+
24
+ return buffer
25
+ }
26
+
27
+ async function screenFullSave(fp) {
28
+
29
+ //screenshot
30
+ let img = await screenshot({ format: 'png' })
31
+
32
+ //writeFileSync
33
+ fs.writeFileSync(fp, img)
34
+
35
+ return img
36
+ }
37
+
38
+ async function screenSave(x, y, width, height, fp) {
39
+
40
+ //screenshot
41
+ let img = await screenshot({ format: 'png' })
42
+
43
+ //cut
44
+ let buffer = await sharp(img)
45
+ .extract({ left: x, top: y, width, height })
46
+ .toBuffer()
47
+
48
+ //writeFileSync
49
+ fs.writeFileSync(fp, buffer)
50
+
51
+ return buffer
52
+ }
53
+
54
+ let obj = {
55
+ screenFull,
56
+ screen,
57
+ screenFullSave,
58
+ screenSave,
59
+ }
60
+
61
+
62
+ export default obj
@@ -0,0 +1,11 @@
1
+ import assert from 'assert'
2
+ //import WMousekey from '../src/WMousekey.mjs'
3
+
4
+
5
+ describe(`WMousekey`, function() {
6
+
7
+ it(`need opencv in nodejs`, function() {
8
+ assert.strict.deepStrictEqual(1, 1)
9
+ })
10
+
11
+ })
@@ -0,0 +1,4 @@
1
+ import addVersion from 'w-package-tools/src/addVersion.mjs'
2
+
3
+
4
+ addVersion()
@@ -0,0 +1,4 @@
1
+ import cleanFolder from 'w-package-tools/src/cleanFolder.mjs'
2
+
3
+
4
+ cleanFolder('docs')
@@ -0,0 +1,33 @@
1
+ import rollupFiles from 'w-package-tools/src/rollupFiles.mjs'
2
+ import getFiles from 'w-package-tools/src/getFiles.mjs'
3
+
4
+
5
+ let fdSrc = './src'
6
+ let fdTar = './dist'
7
+
8
+
9
+ rollupFiles({
10
+ fns: getFiles(fdSrc),
11
+ fdSrc,
12
+ fdTar,
13
+ nameDistType: 'kebabCase',
14
+ globals: {
15
+ 'path': 'path',
16
+ 'fs': 'fs',
17
+ 'child_process': 'child_process',
18
+ 'util': 'util',
19
+ '@u4/opencv4nodejs': '@u4/opencv4nodejs',
20
+ 'screenshot-desktop': 'screenshot-desktop',
21
+ 'sharp': 'sharp',
22
+ },
23
+ external: [
24
+ 'path',
25
+ 'fs',
26
+ 'child_process',
27
+ 'util',
28
+ '@u4/opencv4nodejs',
29
+ 'screenshot-desktop',
30
+ 'sharp',
31
+ ],
32
+ })
33
+
@@ -0,0 +1,4 @@
1
+ import modifyReadme from 'w-package-tools/src/modifyReadme.mjs'
2
+
3
+
4
+ modifyReadme()