Controlling V4 with C#/COM interface

bcbarnes wrote on 1/21/2003, 7:04 AM
Disclaimer: All the information below was gathered by me personally, without the help or knowledge of the fine folks at SOFO. Because V4 is still in beta, things may change and the following may not work once the final version is released. Use at your own risk.

Well, I've done a little bit of playing around, and here's what I've come up with so far. There is more than just a scripting engine in V4 - there is an entire COM interface - which means that any language that supports COM and .NET can interact with V4.

For example, here's the equivelant of the "simple.vb" script, written in C#:

1. Create a standard C# windows application using .NET
2. Add a reference to "Interop.VegasCOM.dll", which is located in the V4 installation directory
3. Add the following code to the "main" function:

string VersionString = "<Not Set>";

VegasCOMClass VegasApp = new VegasCOMClass();
VegasApp.GetVersionString(ref VersionString);
MessageBox.Show(VersionString);

Note: If V4 is currently running, this works fine. If V4 is not currently running, it will be started automatically by Windows. In this case, however, I am getting an error message from V4 as it starts. I haven't debugged this yet. Everything else still works.

You can use ILDASM to view inside Interop.VegasCOM.dll and see what functions are provided.

Comments

Cheesehole wrote on 1/21/2003, 7:17 AM
wow thanks this is really cool :)
RichMcG wrote on 1/22/2003, 9:29 PM
I was trying this out and get the error type or namespace not found. I referenced the DLL but and V4 is running in the background.

Any ideas?
RichMcG wrote on 1/22/2003, 9:59 PM
Ahhh full namespace names help if I do not define that up above.

SonicFoundry.Vegas.VegasCOMClass VegasApp = new SonicFoundry.Vegas.VegasCOMClass();
VegasApp.GetVersionString(ref VersionString);
MessageBox.Show(VersionString);
Jimco wrote on 1/22/2003, 10:32 PM
That being the case, there should be a COM DLL that is not a COM callable wrapper for .NET for those who are not developing on the .NET platform or for those who would prefer not to use COM interop.

Jim
Jimco wrote on 1/22/2003, 10:37 PM
Oh, and no reason to suffer through ILDasm. Just use the Object Browser. :)

Jim
davydrey wrote on 6/17/2003, 11:11 AM
I want to use 'SonicFoundry.Vegas.Vegas' including 'SonicFoundry.ScriptHost.dll' !

but when i do that :

SonicFoundry.Vegas.Vegas myVegas = new SonicFoundry.Vegas.Vegas(); (in c# language) , a error occured : saying that this object want more than ONE parameter but NO DOCUMENTATION

Can you help me please ?
SonyDennis wrote on 6/20/2003, 5:14 PM
The Vegas scripting API is not intended to be accessed directly using the COM interface.
///d@
SonyPJM wrote on 6/24/2003, 11:55 AM
Correct:

The 3 supported means of using the scripting api are:

) run script menus/buttons
2) run script from command line (vegas40.exe -SCRIPT:script path)
3) run script via WM_COPYDATA message

We are looking into other possibilities for future releases.