Visual Basic Scripts Still Supported ?

Richard-N wrote on 8/29/2025, 11:30 AM

I have not written a Vegas script since about Vegas 14 when, given my familiarity with Visual Basic, I wrote and compiled VB code into .dll files using Visual Studio.

Having moved to Vegas 365 now V22 I tried writing an ACSII .vb script to be told by the script engine that the language is no longer supported. I am undecided if this is a meaningful message or not. In this section of the forum there remains reference throughout to VB ASCII scripts and nowhere do I see that Ver 22 no longer supports VB scripts.

I acknowledge that VB has pretty much been dropped by the community in favour of C# and Javascript, however it would be good to know the definitive situation. It appears Microsoft is also phasing out VBS very shortly.

I presume V22 still runs .dll code nomatter if written in VB, C# or js..... But what version of Visual Studio is required?

 

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100

Comments

Jack S wrote on 8/29/2025, 2:35 PM

I've written scripts in c# for a while now and used Visual Studio to build a dll (application extension) containing those scripts, for use in Vegas Pro. So yes, VP does still run .dll code providing it conforms with the Vegas Pro API.

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

jetdv wrote on 8/29/2025, 3:21 PM

I honestly do not know about VB in current versions. Here's what the help file says:

Creating a script


VEGAS Pro scripting uses the Microsoft .NET framework for scripting. You can write scripts in C# or Visual Basic .NET.

Editing an existing script


All you need to edit a script is a simple text editor. The scripts that are included with VEGAS Pro are fully commented to help you find and edit the parameters you need.

Create a copy of the script (.vb or .cs) file you want to edit, assigning a descriptive name to the copy.

Open the new copy of the script in your text editor and edit the script as needed.

However, I tried running an old .VB script that is on my system and also got:

System.NotSupportedException: Language not supported.
   at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)

Compiled to .dll *might* still work but I wouldn't guarantee that either.

I even made sure the "imports" line referenced "ScriptPortal" instead of "Sony".

Richard-N wrote on 8/29/2025, 4:53 PM

I got the same result trying to run a simple 'Hello World' VB script. Strangely, the Vegas dialogue to run an ASCII text script is pre-populated to display .cs .vb and .js files amongst others, suggesting that VB is not dead. It would be nice however to know definitively.

Clearly the Intellisense provided by VS is invaluable for both writing & debugging. My umderstanding of VS is that the compiled .dll regardless of the language it was written in.

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100

jetdv wrote on 8/30/2025, 9:28 AM

Unless VB is no longer providing the proper method of being called from VEGAS. I know JScript still does not need anything special but C# requires the "EntryPoint" class and "FromVegas" function. Likewise VB used to require the MainModule module and Main subroutine.

Version.js (works)

import System;
import System.IO;
import System.Windows.Forms;
import ScriptPortal.Vegas; 

MessageBox.Show(Vegas.Version);

Version.cs (works)

using System;
using System.IO;
using System.Windows.Forms;
using ScriptPortal.Vegas; 

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        MessageBox.Show(vegas.Version);
    }
}

Version.vb (does not work)

' This simple VBScript displays the version of the Vegas
' application in a message box.  Notice that any script that talks to
' Vegas will import the Sony.Vegas 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: Feb. 26, 2004.

imports System.Windows.Forms
imports ScriptPortal.Vegas

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

Note, in this last one I changed "Sony" to "ScriptPortal" on the imports line.

Richard-N wrote on 8/31/2025, 3:54 AM

Thanks @Jetdv I agree with your results.

Interestingly my few .dll files dating from Sony Vegas days no longer work. I guess because they referenced the previous Sony.Vegas scripting engine that is no longer present.

I am not convinced the structure of the VB script you quote (2004) above is correct. It is at variance with my recollections of how the scripts used to be written..... but who knows what has changed? I will continue to experiment.

Last changed by Richard-N on 8/31/2025, 3:55 AM, changed a total of 1 times.

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100

jetdv wrote on 8/31/2025, 7:17 AM

@Richard-N For the older scripts, just change "Sony" to "ScriptPortal" and they should work fine (assuming JScript or C#).

Personally, I would recommend you change to C#. There's tons of tutorials on my YouTube page now and all are in C#.

https://www.youtube.com/@JetDVScripts/videos

Richard-N wrote on 9/4/2025, 6:57 AM

I note the following pearl of wisdom from the Vegas Pro Scripting FAQs referring to ASCII scripts in .VB .JS and .CS...... Perhaps that time has already past for .VB ?

At some point in the future, you can expect VEGAS to stop supporting VSA scripts since the .NET Framework will eventually drop the VSA engines.

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100

Richard-N wrote on 9/10/2025, 6:05 AM

I must admit I have never warmed to to either Java tor C#. I have quite a long history with Visual Basic and consequently I have avoided learning anything else. After much tinkering I can conclude that VB ASCII scripts with a .vb extension are no longer supported by the Vegas Script Engine, despite still being offered as options at:

Tools > Scripting > Run Script

Using Visual Studio 2022 (and I suspect VS2015 works also) you can compile .dll files in whatever language you like and they run quite happily. However when opening a new solution in VS for VB you should search and select:

"Class Library (.NET Framework)" as other options won't work. You should also ensure .NET framework version 4.8 options are installed with VS as later versions do not appear to support the scripting host. You must ensure that the two 'Include' references are added in the Solution Explorer window before adding them in code.

A simple 'Hello World' looks like this:

Imports ScriptPortal.Vegas
Imports System.Windows.Forms

Namespace HelloWorld
    Public Class EntryPoint

        Sub FromVegas(ByVal Vegas As Vegas)
            MessageBox.Show("Welcome to Magix Vegas", "Hello World")
        End Sub

    End Class
End Namespace

 

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100

jetdv wrote on 9/10/2025, 8:22 AM

You may ultimately find that C# offers more options for scripting than VB. Plus, pretty much all the examples you'll find (and all the ones on my site) are in C# so that should give you a good learning curve on C#.

The same is true with C# - you must choose the "Class Library (.NET Framework)" as other options won't work and set it to .NET 4.8.

If you want to create a Custom Command/Extension, I'm not sure about using VB for that.

Richard-N wrote on 9/18/2025, 7:50 AM

@jetdv Being a Vegas Pro 365 guy I have recently upgraded to Version 23 and so I am targeting the ScriptPortal.Vegas.dll that comes with that. Having fooled around with the current API for a while, a couple of things have become clear. Firstly there are significant gaps and errors in the online API documentation that make code writing very time consuming. The VS Intellisense facility makes that problem easier but does not fix it. Secondly, there appear to have been many changes in methods and properties since Magix acquired Vegas. It is quite possible these changes may break some of your code that dates from that period.

There now appears to be no way to expose some the following Video FX parameters in code.

Effect.Parameter(), Effect.Parameters(), and Effect.GetParameterByName() no longer work. You can call any of the fx pre-saved presets by name, but individual parameters appear no longer exposed. You can manipulate those fx that support envelope-compatible parameters but of course this does not apply to the likes of HSL Adjust or Brightness & Contrast.

I take your point about the lack of code examples in VB.NET, I guess as Vegas has matured with added features the need for automation has diminished. As far as the limitations of VB.NET vs C#, they both address the same API so should both have the same capabilities. I have looked at examples of docked windows in VB but have not got around to trying it yet.

This code tryout is a simple example of adding a +5% Saturation using 'HSL Adjust'. Unfortunately the lack of parameter exposure forces the use of an fx Preset..... and almost not a curly bracket in sight!

Imports ScriptPortal.Vegas
Imports System.Windows.Forms

Namespace HSLadjust
    Public Class EntryPoint
        Sub FromVegas(ByVal Vegas As Vegas)

            For Each track As Track In Vegas.Project.Tracks

                If TypeOf track Is VideoTrack Then

                    For Each MyEvent As TrackEvent In track.Events

                        Dim fxname As String = "HSL Adjust"         'The name of the Plug-In
                        Dim Preset As String = "+05% Saturation"  'The name of a pre-saved preset

                        If MyEvent.Selected AndAlso TypeOf MyEvent Is VideoEvent Then

                            Dim videoEvent As VideoEvent = CType(MyEvent, VideoEvent)

                            ' Remove any existing HSL fx from the event
                            Dim fxToRemove As New List(Of Effect)

                            For Each fxRemove As Effect In videoEvent.Effects
                                If fxRemove.PlugIn.Name = fxname Then
                                    fxToRemove.Add(fxRemove)
                                End If
                            Next

                            For Each fxTarget In fxToRemove
                                videoEvent.Effects.Remove(fxTarget)
                            Next

                            ' Add the HSL Adjust FX

                            Dim fxNode As PlugInNode = Vegas.VideoFX.FirstOrDefault(Function(fx) fx.Name = fxname)
                            If fxNode Is Nothing Then
                                MessageBox.Show($"Effect '{fxname}' not found.")
                                Return
                            End If

                            'Add a specific preset to the effect
                            Dim effect As New Effect(fxNode)
                            videoEvent.Effects.Add(effect)
                            effect.Preset = Preset

                        End If

                    Next MyEvent

                End If

            Next

        End Sub

    End Class

End Namespace

 

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100

jetdv wrote on 9/18/2025, 9:19 AM

@Richard-N Here's an exact duplicate of your code converted to C# with a modification to make it work with any language:

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;

            string fxname = "HSL Adjust"; //This isn't really needed. Using the UID is more accurate/language independent

            string plugInUID = "{Svfx:com.vegascreativesoftware:hsladjust}";
            string Preset = "+05% Saturation";

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (VideoEvent vEvnt in myTrack.Events)
                    {
                        if (vEvnt.Selected)
                        {
                            for(int i=vEvnt.Effects.Count - 1; i >= 0; i--)
                            {
                                Effect thisEffect = vEvnt.Effects[i];
                                if (thisEffect.PlugIn.UniqueID == plugInUID)
                                {
                                    vEvnt.Effects.Remove(thisEffect);
                                }
                            }

                            PlugInNode fx = myVegas.VideoFX;
                            PlugInNode plugIn = fx.GetChildByUniqueID(plugInUID);

                            Effect effect = new Effect(plugIn);
                            vEvnt.Effects.Add(effect);

                            effect.Preset = Preset;
                        }
                    }
                }
            }
        }
    }
}

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

Now, let's look at changing individual parameters. First you need to get the names and types of the parameters. I have a tutorial for that:

For HSL Adjust, there are only three parameters - here are the screen names, parameter names, and parameter types:

Add to Hue - AddToHue - Double
Saturation - Saturation - Double
Luminance - Luminance - Double

So we simply need to get the "Saturation" parameter and change the value. That can only be done with OFX effects (which HSL Adjust is) but we have to first get the OFX effect. In your code, I cannot see where you tried to do that but here's the C# version that will change just that one parameter:

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;

            string fxname = "HSL Adjust"; //This isn't really needed. Using the UID is more accurate/language independent

            string plugInUID = "{Svfx:com.vegascreativesoftware:hsladjust}";
            string Preset = "+05% Saturation";  //Also not needed as we'll adjust the parameters individually


            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (VideoEvent vEvnt in myTrack.Events)
                    {
                        if (vEvnt.Selected)
                        {
                            for(int i=vEvnt.Effects.Count - 1; i >= 0; i--)
                            {
                                Effect thisEffect = vEvnt.Effects[i];
                                if (thisEffect.PlugIn.UniqueID == plugInUID)
                                {
                                    vEvnt.Effects.Remove(thisEffect);
                                }
                            }

                            PlugInNode fx = myVegas.VideoFX;
                            PlugInNode plugIn = fx.GetChildByUniqueID(plugInUID);

                            Effect effect = new Effect(plugIn);
                            vEvnt.Effects.Add(effect);


                            if (effect.PlugIn.IsOFX)
                            {
                                OFXEffect ofx = effect.OFXEffect;

                                OFXDoubleParameter saturation = (OFXDoubleParameter)ofx["Saturation"];
                                saturation.Value = 1.0500;
                            }
                        }
                    }
                }
            }
        }
    }
}

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

The important part is here:

                            if (effect.PlugIn.IsOFX)
                            {
                                OFXEffect ofx = effect.OFXEffect;

                                OFXDoubleParameter saturation = (OFXDoubleParameter)ofx["Saturation"];
                                saturation.Value = 1.0500;
                            }

And this can also be modified to add multiple keyframes over time on the parameter.

Richard-N wrote on 9/18/2025, 9:31 AM

Thanks Edward, very interesting. I see the subtlety lies in how you cast the Effect. I will give it a go

Panasonic HDC-X1500 I use .MOV output of 2160p-50 at 150M

I stabilise the footage where needed with Mercalli 6 saving to mp4 AVC for edit

Vegas Pro 23.0 My finished target is normally 2160p HEVC or AVC, occasionally 1080p

Benq EL287OU 28" native 4k monitor

Intel i9-9900 Skylake X @ standard 3.50Ghz - No overclocking

32GB Corsair RAM 3200Mhz

Booting from a fast on-board M.2 drive and the workspace is also on-board M.2

NVIDIA RTX4060 + the latest studio driver on offer

Windows 11 Home Ver 10.0.26100 Build 26100