Another type of GUI control

Topics related to the TouchControl Server software.
Nocko!
Posts: 3
Joined: Thu Oct 12, 2017 11:43 am

Re: Another type of GUI control

Post by Nocko! » Fri Nov 10, 2017 4:24 pm

Hi Guys,

yes, I think for us iRulers we need massive help with the "scripting" thing. Dave was so kind to help me with a few things but he won't have the time to teach us Javascript. We should give code snippets and hints here in the forum, although it will be difficult to keep them here in a way to find them.

To make a start. I was wondering how to show any feedback at all:

alert(_feedback);

Will pop up a window within the app (not the server) that shows the feedback. This way you can test if there is any feedback at all and what it looks like.

This "script"

_setText(‘myLabel’, _feedback)

will show the feedback without modifications on the label called myLabel.

From my setup:
This script is placed within the feedback client for my ML preamp. In detail:

[notimeout]; _setText('MLVolumeLabel', _feedback.substr(6, 10))

[notimeout]; --- means that the script doesn't "time out", eg. doesn't show an error message if there is no feedback or if takes to long to receive the feedback. Might be helpful.

_setText('MLVolumeLabel', --- places the feedback on the label called MLVolumeLabel. Of course you can use any other name.

_feedback.substr(6, 10)) --- works for me to show the specific value I want to separate from the feedback. Don't know exactly what the "6" and "10" mean in a technical way. I think the "6" cuts off all feedback before the sixth position within the feedback. You can play a little bit with this values to cut a feedback to show something that makes sense.

Now a lot of questions to parse (?) feedbacks:

1. I have a device that separates the feedbacks with this • sign. The feedback I am interested in is between these signs and looks like this in a simplified way:
...
•The Eagles•
•Hotel California•
•Hotel California (remastered edition)•
•1979•
•EMI Records•
...

How can I separate the information in a feedback that looks like this and show them? Just a hint in the right direction would be very appreciated.

2. Something simple but I am too stupid:

This
[notimeout]; _setText('MLSourceLabel', _feedback.substr(7, 3))

shows which input is selected on my preamp on the label called MLSourceLabel. The feedback from the preamp changes based on the commands it receives. So the feedback is not static. I want to start an action, eg. simulate a button press when the feedback is "CD" or "Aux".

Any ideas...?

To be true: I don't even know how to simulate a button press from a more simple feedback, something like "if this...than that". In terms of Javascript the examples Dave gave us with his great documentation are far to high for my small mind...

3. XML ???

I have another device that sends its feedbacks as something like this:

<result>
<changed id="6043" new_value="0.10"/>
</result>

This seems to be something like a small xml file regarding the message in the browser. The correct feedback as shown in the browser is also shown within the server if I test the feedback script. But within the app there is only a pop up window that shows "OK". How can I show feedbacks of this kind within the app?

4. Toggle commands:
Any idea how to create a toggle button?

There are about a 1000 and more questions but I think this is a good start. Sorry for my lack of knowledge...
Nocko!

sfatula
Posts: 9
Joined: Wed Nov 01, 2017 10:17 pm

Re: Another type of GUI control

Post by sfatula » Tue Nov 21, 2017 7:22 pm

For your #1, I don't know what character that bullet point is, so, not sure, don't even know how to type it. If it was a ~ for example, you would use:

var YourResult = YourString.match('/~(.*)~/');

YourResult[1] would have the value between those characters.

For your #2, you probably need a Feedback Client button which processes the feedback not otherwise processed by buttons. In there, you would select only that feedback that has the desired string in it, and, once you do that, you can use the return string to execute any button you want. But I am not really clear of the sequence of operations you are speaking of. Maybe when input is changed, and feedback sends CD with some stuff wrapped around that string, execute a button? If so, your feedback script would simply return '[#]DeviceName^ButtonName'; Page 99 of the manual.

For #3, assuming you want the 0.10? You would use another regex to match that pattern. So, again not sure what you are looking for, but, you might want only 6043, and for those, get the value? You could use a regex something like '/"6043" new_value="(.*)"/g' and it would return the match again in [1]

For #4, a toggle button can be done. Depends if your device has a toggle command or not. So, for example, my Pioneer can set mute via IP, can set unmute via ip, or can toggle mute from whatever it was via IP (I use this). It also depends if your device sends feedback as to whether or not the operation was done. If it did, then, in the feedback script for that button, you can change the image(s) if desired, or anything else (page 113-114 of the manual). So, in the feedback script, if the toggle is one state, you can _setImage(somenewimage), if it's another, a different image, etc. If you do not use a toggle command to your device, but a discrete command, then, you can also change the command sent via _command='New Command To Be Sent Next Time';

Nocko!
Posts: 3
Joined: Thu Oct 12, 2017 11:43 am

Re: Another type of GUI control

Post by Nocko! » Tue Nov 28, 2017 7:43 pm

Hello sfatula,

at the moment I don't find the time to analyze and work with your answer but I want to send you my thanks for your answer. I think this will be very helpful.

Thanks again,
Nocko!

Post Reply