I'm working on response from my Denon receiver. I'm having a little trouble filtering out the letters, e.g. I'm getting the response MV235 instead of the desired 235. I also have a panel tagged VOLUME on the page I've made a page script that looks like this: this first part is the actual page script.
var w, volume; w = widget("VOLUME"); volume = 0; w.label = volume;
this next part is actually a button script run once to make a query for the volume right away - I use the same script for volume up/down on the hard buttons, with an extra line; s.send("MVUP\r"); for adjusting the volume var e,s; e = CF.extender[0]; if (!e) { Diagnostics.log("Extender 0 is not defined"); } else { s = e.serial[0]; if (!s) { Diagnostics.log("Extender 0 is not a serial extender"); } else { s.bitrate = 9600; s.databits = 8; s.parity = 0; // None s.stopbits = 1; w.label = s.match("MV?\r","\r",250); } }
for filtering out the MV part of the response this should do it: var volume = parseInt(response.match(/\d{2,3}/)[0]);
but where do I put that line of code to make work?