OK I've just run a modified version of the template C# Script, as seen below, using MC12.
From what I can see the Media Center Object now get's placed in the ROT
from start up
Which means you just need to use GetActiveObject to get a hold of it.
Maybe JRiver could confirm this for us?
In any case the following style of code ensures compatability with MC11 even if it isn't pretty.
using System;
using System.Windows.Forms;
//css_reference MediaCenter.dll;
class Script
{
static public void Init(object unused, object textBoxReference)
{
System.Windows.Forms.TextBox outputTextbox = (System.Windows.Forms.TextBox)textBoxReference;
MediaJukebox.MJAutomation mediaCenterInterface=null;
try
{
mediaCenterInterface = new MediaJukebox.MJAutomation();
outputTextbox.AppendText("\r\nCreated Object in ROT");
}
catch
{
try
{
mediaCenterInterface = (MediaJukebox.MJAutomation) System.Runtime.InteropServices.Marshal.GetActiveObject("MediaJukebox Application");
outputTextbox.AppendText("\r\nObject already in ROT continuing with recieved reference");
}
catch
{
outputTextbox.AppendText("\r\nSomethings Gone Horribly Wrong!");
}
}
if ( mediaCenterInterface != null )
{
//Show a Sample Message Box Proving we are running!
MessageBox.Show("I am a Running Script!");
//Set the Volume Of Media Center!
MediaJukebox.MJMixerAutomation MCMixer;
MCMixer = mediaCenterInterface.GetMJMixer();
MCMixer.Volume = 80;
}
}
}