Update actions.js

This commit is contained in:
jreynolds67 committed 2025-05-10 21:16:24 -04:00
1 parent c882a020a8
commit c1e9446515
1 file changed
+57 -63
+57 -63
View File
@@ -19,12 +19,6 @@ module.exports = {
}
}
const parseVariable = async (input) => {
if (typeof input === 'string' && input.includes('$(')) {
return await self.parseVariablesInString(input)
}
return input
}
let actions = {
gpi: {
@@ -39,9 +33,9 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let gpiText = await parseVariable(opt.gpi)
let gpiText = await context.parseVariablesInString(opt.gpi)
var gpi = parseInt(gpiText)
cmd =
'GPI ' + (gpi <= 9 && (self.config.model == 'carbonite' || self.config.model == 'acuity') ? '0' : '') + gpi
@@ -65,12 +59,12 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
if (opt.gpi) {
let gpi = await parseVariable(opt.gpi)
let parameter = await parseVariable(opt.parameter)
let gpi = await context.parseVariablesInString(opt.gpi)
let parameter = await context.parseVariablesInString(opt.parameter)
if (parameter === null) {
cmd = 'GPI ' + gpi
} else {
@@ -92,9 +86,9 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let cmd = await parseVariable(opt.cmd)
let cmd = await context.parseVariablesInString(opt.cmd)
sendCommand(cmd)
},
},
@@ -120,10 +114,10 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let bankText = await parseVariable(opt.bank)
let ccText = await parseVariable(opt.cc)
let bankText = await context.parseVariablesInString(opt.bank)
let ccText = await context.parseVariablesInString(opt.cc)
var cc = parseInt(ccText)
cmd = 'CC ' + parseInt(bankText) + ':' + (cc > 9 ? '' : '0') + cc
sendCommand(cmd)
@@ -140,9 +134,9 @@ module.exports = {
default: 'set1',
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let set = await parseVariable(opt.set)
let set = await context.parseVariablesInString(opt.set)
cmd = 'LOADSET ' + set
sendCommand(cmd)
},
@@ -160,9 +154,9 @@ module.exports = {
regex: re_meSource_meNumber,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let mle = await context.parseVariablesInString(opt.mle)
cmd = 'MECUT ' + mle
sendCommand(cmd)
},
@@ -179,9 +173,9 @@ module.exports = {
regex: re_meSource_meNumber,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let mle = await context.parseVariablesInString(opt.mle)
cmd = 'MEAUTO ' + mle
sendCommand(cmd)
},
@@ -208,10 +202,10 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var src = await parseVariable(opt.vidSource)
var dst = await parseVariable(opt.vidDest)
var src = await context.parseVariablesInString(opt.vidSource)
var dst = await context.parseVariablesInString(opt.vidDest)
cmd = 'XPT ' + dst + ':' + src
console.log('ross xpt:', cmd)
sendCommand(cmd)
@@ -258,10 +252,10 @@ module.exports = {
],
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let keyText = await parseVariable(opt.key)
let mle = await context.parseVariablesInString(opt.mle)
let keyText = await context.parseVariablesInString(opt.key)
if (opt.transD === 'TOGGLE') {
cmd = 'KEY' + opt.transT + ' ' + mle + ':' + keyText
} else {
@@ -273,7 +267,7 @@ module.exports = {
actions.ftb = {
label: 'Fade to black',
options: [],
callback: async (event) => {
callback: async (event, context) => {
cmd = 'FTB'
sendCommand(cmd)
},
@@ -291,9 +285,9 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var memID = await parseVariable(opt.memID)
var memID = await context.parseVariablesInString(opt.memID)
cmd = 'MEM ' + memID
sendCommand(cmd)
},
@@ -318,10 +312,10 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var takeID = await parseVariable(opt.takeID)
var layer = await parseVariable(opt.Layer)
var takeID = await context.parseVariablesInString(opt.takeID)
var layer = await context.parseVariablesInString(opt.Layer)
cmd = 'SEQI ' + takeID + ':' + layer
sendCommand(cmd)
},
@@ -338,9 +332,9 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var takeID = await parseVariable(opt.takeID)
var takeID = await context.parseVariablesInString(opt.takeID)
cmd = 'SEQO ' + takeID
sendCommand(cmd)
},
@@ -372,11 +366,11 @@ module.exports = {
useVariables: true
}
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mvID = parseInt(opt.mvID)
let boxID = parseInt(opt.boxID)
var src = await parseVariable(opt.vidSource)
var src = await context.parseVariablesInString(opt.vidSource)
cmd = 'MVBOX:' + mvID + ":" + boxID + ":" + src
sendCommand(cmd)
@@ -404,10 +398,10 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let bankText = await parseVariable(opt.bank)
let ccText = await parseVariable(opt.cc)
let bankText = await context.parseVariablesInString(opt.bank)
let ccText = await context.parseVariablesInString(opt.cc)
var cc = parseInt(ccText)
cmd = 'CC ' + parseInt(bankText) + ':' + (cc > 9 ? '' : '0') + cc
sendCommand(cmd)
@@ -443,10 +437,10 @@ module.exports = {
],
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let keyText = await parseVariable(opt.key)
let mle = await context.parseVariablesInString(opt.mle)
let keyText = await context.parseVariablesInString(opt.key)
cmd = 'KEY' + opt.transT + ' ' + mle + ':' + keyText
sendCommand(cmd)
},
@@ -472,10 +466,10 @@ module.exports = {
default: 'set1',
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let set = await parseVariable(opt.set)
let location = await parseVariable(opt.location)
let set = await context.parseVariablesInString(opt.set)
let location = await context.parseVariablesInString(opt.location)
cmd = 'LOADSET ' + location + ':' + set
sendCommand(cmd)
},
@@ -492,9 +486,9 @@ module.exports = {
default: '1',
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let mle = await context.parseVariablesInString(opt.mle)
cmd = 'MECUT ' + mle
sendCommand(cmd)
},
@@ -502,7 +496,7 @@ module.exports = {
actions.ftb = {
label: 'Fade to black',
options: [],
callback: async (event) => {
callback: async (event, context) => {
cmd = 'FTB'
sendCommand(cmd)
},
@@ -520,9 +514,9 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var memID = await parseVariable(opt.memID)
var memID = await context.parseVariablesInString(opt.memID)
cmd = 'MEM ' + memID
sendCommand(cmd)
},
@@ -540,9 +534,9 @@ module.exports = {
regex: Regex.NUMBER,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let mle = await context.parseVariablesInString(opt.mle)
cmd = 'MEAUTO ' + mle
sendCommand(cmd)
},
@@ -570,10 +564,10 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var src = await parseVariable(opt.vidSource)
var dst = await parseVariable(opt.vidDest)
var src = await context.parseVariablesInString(opt.vidSource)
var dst = await context.parseVariablesInString(opt.vidDest)
cmd = 'XPT ' + dst + ':' + src
console.log('ross xpt:', cmd)
sendCommand(cmd)
@@ -605,10 +599,10 @@ module.exports = {
useVariables: true,
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
var timerAction = opt.timerAction
var timerIDText = await parseVariable(opt.timerID)
var timerIDText = await context.parseVariablesInString(opt.timerID)
var timerID = parseInt(timerIDText)
cmd = 'TIMER ' + timerID + ':' + timerAction
sendCommand(cmd)
@@ -620,7 +614,7 @@ module.exports = {
label: 'Fade to black',
description: 'Not supported on the MDK-111A-K.',
options: [],
callback: async (event) => {
callback: async (event, context) => {
cmd = 'FTB'
sendCommand(cmd)
},
@@ -656,10 +650,10 @@ module.exports = {
],
},
],
callback: async (event) => {
callback: async (event, context) => {
let opt = event.options
let mle = await parseVariable(opt.mle)
let keyText = await parseVariable(opt.key)
let mle = await context.parseVariablesInString(opt.mle)
let keyText = await context.parseVariablesInString(opt.key)
cmd = 'KEY' + opt.transT + ' ' + mle + ':' + keyText
sendCommand(cmd)
},