I'm currently playing around with the internal Vegas COM object (Interop.VegasCOM.dll) and found that it has a feature implemented that allows you to store (probably nearly unlimited) global data in a project, which is also stored in your project files and reloaded! This would be an extremely useful feature if Sony could make this "official". I know you (Sony) probably doesn't like this kind of playing around, but I really hope you make useful, already implemented, features available to us users.
There's only a workaround for this feature using C# (it can't be done using only Reflection, because JScript doesn't allow to pass ref parameters to methods, as far as I know ... or does it?).
I wrote a C# program "Vegascom.cs" like this (only excerpt):
This can be compiled using the command (replace the directory of your Sony Vegas installation accordingly):
or use Visual Studio for .NET using assembly references to Sony.Vegas.dll and Interop.VegasCOM.dll. The resulting Vegascom.dll was copied into Vegas' script directory.
In the Vegas script directory, I then created a script "Ref", consisting of a file "Ref.xml"
And Ref.js:
This basically sets 10'000 strings to some defined values. After I run the script, teh project was stored and I left Vegas.
Finally I modified Ref.js to:
Starting Vegas again and loading the formerly stored project, the script showed that the first mismatch happened at 10'001. So, 10'000 strings were obviously successfully stored in the veggie.
Would be really good if this feature were made permanent... or if we at least could rely on this to continue to work :-) After all the feature is there...
There's only a workaround for this feature using C# (it can't be done using only Reflection, because JScript doesn't allow to pass ref parameters to methods, as far as I know ... or does it?).
I wrote a C# program "Vegascom.cs" like this (only excerpt):
using System;
using System.Reflection;
using Sony.Vegas;
namespace Vegascom
{
public class VCom
{
IVegasCOM vcom;
public VCom()
{
vcom = (IVegasCOM)typeof(ScriptHost).GetField("TheVegasCOM",
BindingFlags.Static|BindingFlags.NonPublic).GetValue(null);
}
public String GetSummaryItem(uint code)
{
String s=null;
vcom.Project_GetSummaryItem(code, ref s);
return s;
}
public void SetSummaryItem(uint code, String item)
{vcom.Project_SetSummaryItem(code, item);}
}
}
This can be compiled using the command (replace the directory of your Sony Vegas installation accordingly):
csc /t:library Vegascom.cs /r:"C:\Program Files\Sony\Vegas 5.0\Sony.Vegas.dll" /r:"C:\Program Files\Sony\Vegas 5.0\Interop.VegasCOM.dll"
or use Visual Studio for .NET using assembly references to Sony.Vegas.dll and Interop.VegasCOM.dll. The resulting Vegascom.dll was copied into Vegas' script directory.
In the Vegas script directory, I then created a script "Ref", consisting of a file "Ref.xml"
<?xml version="1.0" encoding="UTF-8" ?>
<ScriptSettings>
<AssemblyReference IsLocal="true" >Vegascom.dll</AssemblyReference>
</ScriptSettings>
And Ref.js:
import System;
import Sony.Vegas;
import System.Windows.Forms;
import Vegascom;
import System.Reflection;
try
{
var vcom = new VCom();
for (var i=0; i<10000; i++)
{ vcom.SetSummaryItem(i,i.ToString());}
}
catch(e) {MessageBox.Show(e);}
This basically sets 10'000 strings to some defined values. After I run the script, teh project was stored and I left Vegas.
Finally I modified Ref.js to:
import System;
import Sony.Vegas;
import System.Windows.Forms;
import Vegascom;
import System.Reflection;
try
{
var vcom = new VCom();
for (var i=0; i<10001; i++)
{
if (i.ToString() != vcom.GetSummaryItem(i))
{MessageBox.Show(i); break;}
}
}
catch(e) {MessageBox.Show(e);}
Starting Vegas again and loading the formerly stored project, the script showed that the first mismatch happened at 10'001. So, 10'000 strings were obviously successfully stored in the veggie.
Would be really good if this feature were made permanent... or if we at least could rely on this to continue to work :-) After all the feature is there...