PDA

View Full Version : How to make NR clients beep/play sound when a variable is changed



ph0n33z
September 17th, 2009, 05:22 PM
Alright,

I want my touchscreens to beep/play a sound when my doorbell is pressed. I have Girder watching for a zone change where the doorbell is hooked up. How do I get the NR clients to play a sound when a particular variable or zone changes in Girder? Is there a way to tell Girder to do this? Thanks!

Rob H
September 18th, 2009, 11:27 AM
Yes, you can do this - create a scripting action as follows


NetRemote.RunLua([[NetRemote.ExecuteAction(-1014, 1, 7, waveFilePath)]])

But substitute an appropriate string for waveFilePath, making sure to double up any \ characters.

ph0n33z
September 18th, 2009, 12:10 PM
Thanks, Rob! What about doing a beep action?

ph0n33z
September 18th, 2009, 12:47 PM
Sorry to bug you again......

Is it possible to choose to play different sounds/beeps on different NetRemote clients?

Rob H
September 18th, 2009, 12:53 PM
Beep only works on PocketPC clients.

Yes, you can use NetRemote.ClientRunLua instead and specify the client as the first parameter either using it's GUID or IP address.

Alternatively you can use the play sound (expanding) action - something like


NetRemote.RunLua([[NetRemote.ExecuteAction(-1014, 1, 23, "{buttonbeep}")]])

and then on each client you could have the buttonbeep variable set to the name of a different .wav file.

ph0n33z
September 18th, 2009, 01:07 PM
Thanks, Rob. Do I need to add anything else in the script, like an end command or something?

Yes, my n00bness is coming through....

Rob H
September 18th, 2009, 01:20 PM
No, that should be fine. Is it not working?

ph0n33z
September 18th, 2009, 01:26 PM
Well, it isn't working because I don't really understand where to put the script....

If I put the script as an action in Girder, does the wav file have to be located on the netremote client pc or does Girder stream it to them? If it is on the Netremote client, what would the filepath look like? If it is on the Girder client, would it just be something like C:\\Documents and Settings\\Admin.....?

Rob H
September 18th, 2009, 01:48 PM
The .wav file has to be on the NetRemote client

Don't forget that you have to double up backslashes if setting the name from Lua code

ph0n33z
September 18th, 2009, 04:05 PM
Hmm, I must be doing something wrong. Here is what I have.

In Girder, I have the following Script triggered by the doorbell press.


NetRemote.RunLua([[NetRemote.ExecuteAction(-1014, 1, 23, "{buttonbeep}")]])

In the Netremote .lua file, I have the following:


NetRemote.SetVariable("buttonbeep", "C:\\doorbell.wav")

Is that right?

Rob H
September 18th, 2009, 05:08 PM
That looks okay, are you sending this to NR on a PC?

If so then try using DebugView from www.sysinternals.com to see if there are any errors

ph0n33z
September 18th, 2009, 05:25 PM
Yes, NR on a pc. I will run that now.

ph0n33z
September 18th, 2009, 05:36 PM
This is all that happened:

Rate: 48000
Codec supports Double rate.
Rate: 11025
Codec supports Double rate.
Rate: 48000
Codec supports Double rate.
Rate: 11025
Codec supports Double rate.

ph0n33z
September 18th, 2009, 05:39 PM
The above log leads me to believe it is playing.

ph0n33z
September 18th, 2009, 06:02 PM
It works!!! Thank you so much, Rob.

Rob H
September 18th, 2009, 06:21 PM
Don't tell me it was muted? :)

ph0n33z
September 18th, 2009, 06:38 PM
Ummm........

I plead the fifth. :D

Rob H
September 18th, 2009, 08:04 PM
Don't you just hate it when that happens? :)

bl123
September 23rd, 2009, 08:41 PM
Hmm, I must be doing something wrong. Here is what I have.

In Girder, I have the following Script triggered by the doorbell press.


NetRemote.RunLua([[NetRemote.ExecuteAction(-1014, 1, 23, "{buttonbeep}")]])

In the Netremote .lua file, I have the following:


NetRemote.SetVariable("buttonbeep", "C:\\doorbell.wav")

Is that right?



This thread helped me figure out a similar application. The only question I have is what syntax I would use to have the .wav file on a different computer, such as \\HTPC\F:\test.wav

I've tried various iterations with doubled up backslashes and can't seem to get it.

thanks

bl123
September 24th, 2009, 05:39 AM
never mind, finally got it...


\\\\htpc\\F\\xxx.wav

Rob H
September 24th, 2009, 05:50 AM
You can also put the string in [[ ]] quotes which will let you use the normal number of backslashes i.e.


[[\\htpc\F\xxx.wav]]