Script Stubbornly refusing to work

Ariel-Bath-Stone wrote on 1/3/2026, 11:58 AM

Using Vegas Pro 22

I'm trying to generate an SRT file based on the titles within my project. I have a script that does so based on the names of regions, however the names of the titles are NOT the same as the contents of the titles (I.E, a title that displays "Please god help I'm so tired" would be titles VEGAS titles and text)

As such, I've been looking for a script to generate the reigons and name them based on the contents of the title, rather than the name, and found one from Jedtv - as the script itself didn't seem to have a download, I had to copy it off the video manually. I ran into a few errors from me being bad at copying, but once I had (as far as I know) a 1:1 copy of the script, it STILL won't run. The current error I'm getting is:

 

System.ApplicationException: Failed to create instance of main class: 'EntryPoint'.
   at ScriptPortal.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
   at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)

For context, the code currently looks like this:

using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;


namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;
        
        public void Main(Vegas vegas)
        {
            myVegas = vegas;
            
            foreach(Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (VideoEvent Vevnt in myTrack.Events)
                    {
                        if (Vevnt.ActiveTake.IsGenerator)
                        {
                            Effect gEffect = Vevnt.ActiveTake.Media.Generator;
                            
                            if (gEffect.PlugIn.UniqueID == "{Svfx:com.vegascreativesoftware:titlesandtext}")
                            {
                                OFXEffect ofx = gEffect.OFXEffect;
                                OFXStringParameter tparm = (OFXStringParameter)ofx.FindParameterByName("Text");
                                
                                RichTextBox rtfText = new RichTextBox();
                                rtfText.Rtf = tparm.Value;
                                string title = rtfText.Text;
                                
                                ScriptPortal.Vegas.Region newReigon = new ScriptPortal.Vegas.Region(Vevnt.Start, Vevnt.Length, title);
                                myVegas.Project.Regions.Add(newReigon);
                            }
                        
                        }
                    
                    }
                }
            }
        
        }
    }


}

Really not sure what to do. In the video it seemed he had some extra scripts? And from what I can tell from googling, this error occurs when you're missing a dependency, or haven't set the script up correctly.

Also sorry if the answer is really obvious and I seem like an idiot - this is my first time using Vegas.

Comments

jetdv wrote on 1/3/2026, 4:55 PM

Try this.... You're missing the "entry point".

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Ariel-Bath-Stone wrote on 1/3/2026, 5:03 PM

Try this.... You're missing the "entry point".

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Whereabouts do I put this?

Ariel-Bath-Stone wrote on 1/3/2026, 5:08 PM

okay, put it in - getting this error now:

 

C:\Users\trthe\Documents\Test_Scripts\Test_Script.cs(63) : } expected

my script looks like this now:

using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;


namespace Test_Script
{
    
    public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
    public class Class1
    {
        public Vegas myVegas;
        
        public void Main(Vegas vegas)
        {
            myVegas = vegas;
            
            foreach(Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (VideoEvent Vevnt in myTrack.Events)
                    {
                        if (Vevnt.ActiveTake.IsGenerator)
                        {
                            Effect gEffect = Vevnt.ActiveTake.Media.Generator;
                            
                            if (gEffect.PlugIn.UniqueID == "{Svfx:com.vegascreativesoftware:titlesandtext}")
                            {
                                OFXEffect ofx = gEffect.OFXEffect;
                                OFXStringParameter tparm = (OFXStringParameter)ofx.FindParameterByName("Text");
                                
                                RichTextBox rtfText = new RichTextBox();
                                rtfText.Rtf = tparm.Value;
                                string title = rtfText.Text;
                                
                                ScriptPortal.Vegas.Region newReigon = new ScriptPortal.Vegas.Region(Vevnt.Start, Vevnt.Length, title);
                                myVegas.Project.Regions.Add(newReigon);
                            }
                        
                        }
                    
                    }
                }
            }
        
        }
    }
 

Ariel-Bath-Stone wrote on 1/3/2026, 5:09 PM

Scratch that - I'm an idiot lol. Thank you!

jetdv wrote on 1/3/2026, 5:28 PM

You add it at the very bottom... The video explains it all.

Ariel-Bath-Stone wrote on 1/3/2026, 5:30 PM

Oh, I added it to the top - it worked either way so

jetdv wrote on 1/4/2026, 7:17 AM
using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (VideoEvent Vevnt in myTrack.Events)
                    {
                        if (Vevnt.ActiveTake.IsGenerator)
                        {
                            Effect gEffect = Vevnt.ActiveTake.Media.Generator;

                            if (gEffect.PlugIn.UniqueID == "{Svfx:com.vegascreativesoftware:titlesandtext}")
                            {
                                OFXEffect ofx = gEffect.OFXEffect;
                                OFXStringParameter tparm = (OFXStringParameter)ofx.FindParameterByName("Text");

                                RichTextBox rtfText = new RichTextBox();
                                rtfText.Rtf = tparm.Value;
                                string title = rtfText.Text;

                                ScriptPortal.Vegas.Region newReigon = new ScriptPortal.Vegas.Region(Vevnt.Start, Vevnt.Length, title);
                                myVegas.Project.Regions.Add(newReigon);
                            }

                        }

                    }
                }
            }

        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

@Ariel-Bath-Stone, this is how I would have done it.