help with a error message, I bet this is simple

lnetzel wrote on 7/11/2003, 8:44 AM
I have the following script!

--------------------------
Imports System
Imports System.IO
Imports System.Windows.Forms
Imports SonicFoundry.Vegas
Imports System.Collections

Public Module MainModule

Public Sub Main()
Dim anEnum As IEnumerator
Dim Vegas As SonicFoundry.Vegas.Vegas

Try
MessageBox.Show(Vegas.Project.FilePath)
Catch objE As Exception
MessageBox.Show(objE.Message & Chr(10) & objE.StackTrace.ToString & Chr(10))
End Try

End Sub

End Module
------------------------------------------

And when I run it I get the Catch Code and in the messageBox it says.

"Object Reference not se tto an instance of an object.
at SonicFoundry.Vegas.MainModule.Main() in sonicfoundry://VegasScript/__ScriptText__: line 15"

And line 15 is of course the Try to show the Project Filepath!

I have coded this in VS.NET and with the code complete funtion on and VS.NET does'nt underline anything so I wonder what else I can do? Don't you make an instance of the VegasObject like that? There's no New() method on the Vegas so I can't really use that, or can I?

I suspect I have no "Project"-Object and that's what giving the error. How do I use the Loaded Project?

Thanx in advance!


Comments

SonyPJM wrote on 7/11/2003, 9:55 AM
VB scripts have a global object defined for them named VegasApp which is the same Vegas object that is defined for JScripts... in VB, we were not able to name it plain "Vegas" because of name conflicts.

So you code should look like this:


MessageBox.Show(VegasApp.Project.FilePath)