Here's a VBScript Example FINALLY!

lnetzel wrote on 7/11/2003, 4:29 AM
I have searched the web and asked many questions to many people and with a little help from Roger_74 (thank you!!!) on this forum I finally managed to write my frist VBscript example that works!

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

Public Module MainModule

Public Sub Main()
ShowMessage()
End Sub

Private Sub ShowMessage()
MessageBox.Show("hello world")
End Sub

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

So From what I understand you need to put everything in a Module called MainModule and in there Vegas starts to run code from Sub Main() then you can start doing whatever you want!

Comments

jetdv wrote on 7/11/2003, 8:49 AM
Have you downloaded the vegasscripts.zip file from the Vegas download page? In that zip file is a "simple.vb" file that looks as follows:


' This most simple VBScript displays the version of the Vegas
' application in a message box. Notice that any script that talks to
' Vegas will import the SonicFoundry.Vegas.Script namespace. Please also
' notice that the portion of script code that Vegas will invoke must be
' placed in a subroutine named "Main" which is in a module named
' "MainModule".
'
' Revision Date: Jan. 30, 2003.

imports System.Windows.Forms
imports SonicFoundry.Vegas

Public Module MainModule
Sub Main
MessageBox.Show("VegasApp.Version: " & VegasApp.Version)
End Sub
End Module


The one thing you have done is to actually add an additional subroutine (which is a GOOD thing) and successfully called that routine.

I, too, am a Visual Basic programmer. However, I have switched to jscript for my Vegas coding because that is what ALL of the samples I could find are written in. The two are "close enough" in most areas to allow a quick switch. You may want to look at http://www.ayizwe.net/VegasScripts/ for the FAQs page - gives a LOT of beginning information.