-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
49 lines (37 loc) · 1012 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var robot = require('robotjs')
const clipboardy = require('clipboardy')
const { spawnSync } = require('child_process')
spawnSync('/usr/bin/open', ['/Applications/企业微信.app'])
mobileList = ['13173604500', '18648149275', '15967654063', '18648149275']
msg = '这是一条自动群发的消息反反复复'
main()
async function main() {
for (let i = 0; i < mobileList.length; i++) {
const mobile = mobileList[i]
await auto(mobile, msg)
}
}
async function auto(mob, txt) {
clipboardy.writeSync(mob)
await sleep(500)
robot.keyToggle('f', 'down', 'command')
await sleep(500)
robot.keyToggle('v', 'down', 'command')
await sleep(500)
robot.keyTap('enter')
clipboardy.writeSync(mob + txt)
await sleep(500)
robot.keyToggle('v', 'down', 'command')
await sleep(500)
robot.keyTap('enter')
}
function sleep(time) {
let $resolve
const $promise = new Promise((resolve) => {
$resolve = resolve
})
setTimeout(() => {
$resolve()
}, time)
return $promise
}