Skip to content

Commit ef0f1d6

Browse files
Merge pull request #9 from richardwilliamson/master
resolve issue #7 and issue #8
2 parents f6e7751 + f2437c9 commit ef0f1d6

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

osc.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ instance.prototype.actions = function(system) {
147147
type: 'textinput',
148148
label: 'Arguments',
149149
id: 'arguments',
150-
default: '1 "test" 2.5'
150+
default: '1 "test" 2.5'
151151
}
152152
]
153153
}
@@ -157,11 +157,11 @@ instance.prototype.actions = function(system) {
157157

158158
instance.prototype.action = function(action) {
159159
var self = this;
160-
160+
161161
var args = null;
162162

163163
debug('action: ', action);
164-
164+
165165
switch(action.action) {
166166
case 'send_blank':
167167
args = [];
@@ -185,18 +185,31 @@ instance.prototype.action = function(action) {
185185
}];
186186
break;
187187
case 'send_multiple':
188-
let arguments = action.options.arguments.split(' ');
188+
let arguments = action.options.arguments.replace(//g, '"').replace(//g, '"').split(' ');
189189
let arg;
190-
190+
191191
if (arguments.length) {
192192
args = [];
193193
}
194-
194+
195195
for (let i = 0; i < arguments.length; i++) {
196+
console.log("looking at "+i);
197+
if (arguments[i].length == 0)
198+
continue;
196199
if (isNaN(arguments[i])) {
200+
var str = arguments[i];
201+
if (str.startsWith("\""))
202+
{ //a quoted string..
203+
while (!arguments[i].endsWith("\""))
204+
{
205+
i++;
206+
str += " "+arguments[i];
207+
}
208+
209+
}
197210
arg = {
198211
type: 's',
199-
value: arguments[i].replace(/"/g, '').replace(/'/g, '')
212+
value: str.replace(/"/g, '').replace(/'/g, '')
200213
};
201214
args.push(arg);
202215
}
@@ -219,14 +232,14 @@ instance.prototype.action = function(action) {
219232
default:
220233
break;
221234
}
222-
235+
223236
if (args !== null) {
224237
debug('Sending OSC',self.config.host, self.config.port, action.options.path);
225238
console.log('sending osc');
226239
console.log(args);
227240
self.system.emit('osc_send', self.config.host, self.config.port, action.options.path, args);
228241
}
229-
242+
230243

231244
};
232245

0 commit comments

Comments
 (0)