Sound script

  • 213 Views
  • Last Post 01 February 2014
southal523 posted this 30 January 2014

If you are willing to convert the sound to a WAV format, the below works (make sure you update the location of the WAV file on your PC):

_____________________


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Media;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;

public class PlayWavFile : ScriptBase, ScriptInterface {

public void runScript() {
try {
string wavFile = @"e:\applause.wav";
SoundPlayer playWav = new SoundPlayer(wavFile);
playWav.Play();

} catch (Exception ex) {
var message = ex.Message;
writeLog(message);
}
}
}

Order By: Standard | Newest | Votes
Rod posted this 30 January 2014

Your best bet is to wait for the Run File, GET and POST request integration. Vote here: http://incontrolha.uservoice.com/forums/218427-general/suggestions/5390053-add-actions-to-incontrol-http-get-post-run-file

Thatll be easy to run a sound script from theRun File`.

Rod

southal523 posted this 31 January 2014

Rod,

Thanks!

Axial-User posted this 01 February 2014

If you are willing to convert the sound to a WAV format, the below works (make sure you update the location of the WAV file on your PC):

_____________________


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Media;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;

public class PlayWavFile : ScriptBase, ScriptInterface {

public void runScript() {
try {
string wavFile = @"e:\applause.wav";
SoundPlayer playWav = new SoundPlayer(wavFile);
playWav.Play();

} catch (Exception ex) {
var message = ex.Message;
writeLog(message);
}
}
}

Close