Skip to content

Commit

Permalink
V1.2.22 - Added variable support on both action and feedback inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
McHauge committed Aug 20, 2021
1 parent 526441f commit d6446c0
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 121 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,8 @@ and if there is more than one parameter use "&" as a separator between them like
- Added Actions and Feedbacks for Routable "multiview overlays" / "Layers" (Check help guide for more info)
- Updated Help.md file
- Added Presets for new Actions

**V1.2.22**

- Added support for variables in all text fields inside Actions (but currently only support one variable pr field)
- Added support for variables in all text fields inside Feedbacks (but currently only support one variable pr field)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "studiocoast-vmix",
"version": "1.2.21",
"version": "1.2.22",
"api_version": "1.0.0",
"keywords": [
"Software",
Expand Down
16 changes: 15 additions & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,21 @@ exports.executeAction = function (action) {

// All input values should be encoded. See vMix TCP Api
for (const property in action.options) {
opt[property] = encodeURIComponent(action.options[property])
// if an option includes a variable, get it's value and replace the name for the actual value
if (String(action.options[property]).includes('$(')) {
x = String(action.options[property].split('$(')[1]).split(')')[0]
var str = x.split(':') // Split instance and variable
var selctInstances = str[0]
var selctVariable = str[1]
var temp

// Gets the value of the selected value
this.system.emit('variable_get', selctInstances, selctVariable, (definitions) => (temp = definitions))
opt[property] = String(action.options[property]).split('$(')[0] + temp + String(action.options[property]).split('$(')[1].split(')')[1]
} else {
opt[property] = action.options[property]
}
opt[property] = encodeURIComponent(opt[property])
}

if (action.action === 'programCut') {
Expand Down
Loading

0 comments on commit d6446c0

Please sign in to comment.