-
Notifications
You must be signed in to change notification settings - Fork 0
/
musiclauncher.js
41 lines (37 loc) · 1.17 KB
/
musiclauncher.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
const { spawn, exec } = require('node:child_process');
const process = require('node:process');
let midiPid
let yousicianPid
spawn("C:\\Program Files\\MidiKey2Key\\MidiKey2Key.exe")
setTimeout(
() => {
spawn("C:\\Users\\glen_\\AppData\\Roaming\\Yousician Launcher\\Yousician Launcher.exe")
setTimeout(
() => {
exec('tasklist', function (err, stdout, stderr) {
tasks = stdout.matchAll(/^Yousician.exe.+$/gmi)
for (const result of tasks) {
let item = result[0].split(/\s+/)
console.log(item[1])
yousicianPid = item[1]
}
});
}
, 6000);
}
, 1500);
exec('tasklist', function (err, stdout, stderr) {
tasks = stdout.matchAll(/^MidiKey2Key.exe.+$/gmi)
for (const result of tasks) {
let item = result[0].split(/\s+/)
midiPid = item[1]
}
});
process.on('SIGINT', () => {
console.log("killing ", midiPid)
process.kill(midiPid)
console.log("killing ", yousicianPid)
process.kill(yousicianPid)
console.log("bye")
process.exit()
});