forked from CiscoDevNet/roomdevices-macros-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-macro
executable file
·24 lines (20 loc) · 902 Bytes
/
run-macro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env node
/**
* Let's you run macros easily from node (your laptop) instead of macro editor (device)
* without changing any code in the macro.
*/
const adapter = require('./universal-adapter');
async function go(host, username, password, macro) {
const videoDevice = { host, username, password };
await adapter(videoDevice);
require(macro); // macro starts with xapi available
}
if (process.argv.length < 6) {
console.log('Run a Webex Device macro remotely from a node.js environment');
console.log('Usage: ./run-macro <host> <username> <password> <macrofile>');
console.log('\neg: ./run 10.47.31.28 admin mypwd ./mymacro.js')
console.log('NOTE: macro file path is relative to the run-macro scripts folder, and must typically start with ./');
process.exit(1);
}
const [exec, script, host, username, password, macro] = process.argv;
go(host, username, password, macro);