using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
public class DefaultEventHandler : MyMovies.ProgramEventHandler
{
//Return the name of the event handler
public string Name
{
get { return "Default Event Handler"; }
}
//Return the version of the event handler
public double Version
{
get { return 1.0; }
}
//Return a description of the event handler
public string Description
{
get { return "Default Event Handler"; }
}
//Use this function to perform actions when My Movies is launched
public void Launched()
{
WriteLog("DefaultEventHandler.Launched");
//System.Windows.Forms.MessageBox.Show("It Works!");
}
//Use this function to perform actions when playback is started
public void PlayStarted(MyMovies.ProgramEventHandler.PlayElement itmPlayElement, MyMovies.ProgramEventHandler.PlayEnvironment itmPlayEnvironment, MyMovies.ProgramEventHandler.PlayType itmPlayType, string strMediaPath)
{
WriteLog("DefaultEventHandler.PlayStarted");
//Run the scripts that will lower the lights
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "C:\\Program Files (x86)\\HomeSeer HS2\\Scripts\\dim_lights.bat";
proc.Start();
}
//Use this function to perform actions when playback is stopped. If intros or trailers is enabled, this is only fired when the actual items playback is stopped.
public void PlayStopped()
{
WriteLog("DefaultEventHandler.PlayStopped");
//Run the scripts that will raise the lights
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "C:\\Program Files (x86)\\HomeSeer HS2\\Scripts\\raise_lights.bat";
proc.Start();
}
//Use this function to be informed when a title is added to the users collection
public void TitleAdded(int intTitleId, int intEventSource, int intSourceType)
{
WriteLog("DefaultEventHandler.TitleAdded");
System.Windows.Forms.MessageBox.Show("It Works!");
//intEventSource 1: By user
//intEventSource 2: By folder monitoring
//intEventSource 3: By disc copy
//intEventSource 4: By Media Changer monitoring
//intEventSource 5: By folder import
//intEventSource 0: By unknown source
}
private void WriteLog(string strString)
{
StreamWriter strLogger = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\My Movies\\DefaultEventHandler.log", true, Encoding.Default);
strLogger.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH

m

s . ff") + " - " + strString);
strLogger.Close();
}
}
Is the event handler code I wrote that just let me mess with those two raise_lights and dim_lights batch files after this was compiled. This is in C#, which I don't know very well so there might be a better way of doing this but this should get you on the right track at least.