-
Extension vs. Script
Mornin all…
I’m trying to do some evaluation of Sony’s scripting capabilities. Have some initial stuff that worked as a script, but for some reason, things are not working if I run them as an extension. A simple example is:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;
using Sony.Vegas;namespace Media_Test
{
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
MessageBox.Show("Script Start...");//String tNewFile = "G:/project_TEST/00_Layout/avis/Sc062_S0004.00.avi";
String tNewFile = "G:\\project_TEST\\00_Layout\\avis\\Sc062_S0004.00.avi";
Media m = new Media(tNewFile);MessageBox.Show("Script End...");
}
}
}
works fine as a script, but if I modify it as an extension:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using Sony.Vegas;namespace Media_Test2
{
public class Media_Test2 : ICustomCommandModule
{
protected Vegas myVegas = null;public void InitializeModule(Vegas vegas)
{
myVegas = vegas;
myVegas.AppDeactivate += new EventHandler(myAppDeactivate);
}void myAppDeactivate(Object sender, EventArgs args)
{}
public ICollection GetCustomCommands()
{
CustomCommand myToolCommand = new CustomCommand(CommandCategory.Tools, "Media_Test2");
myToolCommand.DisplayName = "Media Test Two";
myToolCommand.Invoked += this.HandleInvoked;
return new CustomCommand[] { myToolCommand };
}void HandleInvoked(Object sender, EventArgs args)
{
MessageBox.Show("Script Start...");
string tNewFile = "G:/project_TEST/00_Layout/avis/Sc062_S0004.00.avi";
MessageBox.Show(tNewFile, "tNewFile");
try
{
Media m = new Media(tNewFile);
}
catch (Exception e)
{
myVegas.ShowError(e);
}
MessageBox.Show("Script End...");
}
}
}
I get COM errors like:
System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at Sony.Vegas.IMediaCOM.AddToPool(String path, Boolean addToProperBin, UInt32& mediaID, MetaPathType& metaPathType)
at Sony.Vegas.Media..ctor(String path)
at Media_Test2.Media_Test2.HandleInvoked(Object sender, EventArgs args)I’m at a loss at this point at what I am forgetting (though I bet its something simple…)
Configuration is Sony Vegas 8.0b (build 217) running on Microsoft Windows XP Professional x64 SP2 on Dual Core AMD Opteron 2.41GHz and 4G ram.
TIA,
krashP.S. side note – I notice if I pass in a media path (to the script) that uses “/” for the path, I get the whole path as the media name, where if I use “\\”, I just get the media file name…
