From 9844804d98352d3124fc0fb58cffa983b8c69bc8 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 5 May 2021 09:48:22 +0200 Subject: [PATCH] remote control: add `/SCRIPT` command to run scripts remotely --- CHANGELOG.md | 3 +++ package.json | 2 +- resources/docs/docs/remote-control.md | 6 ++++++ src/client/remote-control.js | 10 +++++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ad71c3..babcd9e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ - editor - make tree item blink when hitting "Show in tree" +- remote control + - add `/SCRIPT` command to run scripts remotely + ## 1.9.3 - bug fixes diff --git a/package.json b/package.json index df40d4fe..805764a4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.9.3", + "version": "1.9.4", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/resources/docs/docs/remote-control.md b/resources/docs/docs/remote-control.md index 0296f205..bec57fd4 100644 --- a/resources/docs/docs/remote-control.md +++ b/resources/docs/docs/remote-control.md @@ -217,3 +217,9 @@ Save current session to `path.json`. If `path.json` is omitted, current session' #### `/TABS tab_id1 tab_id2 ...` Open the tabs designated by the id parameters. + +---- + +#### `/SCRIPT code` + +Run code as if it where executed by a script widget. diff --git a/src/client/remote-control.js b/src/client/remote-control.js index 784bea86..c38e9b3b 100644 --- a/src/client/remote-control.js +++ b/src/client/remote-control.js @@ -4,7 +4,8 @@ var {updateWidget} = require('./editor/data-workers'), stateManager = require('./managers/state'), sessionManager = require('./managers/session'), deepExtend = require('deep-extend'), - notifications = require('./ui/notifications') + notifications = require('./ui/notifications'), + uiConsole = require('./ui/ui-console') var callbacks = { '/EDIT': function(args) { @@ -283,6 +284,13 @@ var callbacks = { } } } + }, + '/SCRIPT': function(args) { + + if (!Array.isArray(args)) args = [args] + + uiConsole.script.setValue(args[0], {sync: true, send: true}) + } }