Adding VideoFX from a script in Vegas 22

Richard-N wrote on 9/4/2025, 8:01 AM

I would like to add a VideoFX to a selected clip using a .js or c# script as opposed to a compiled .dll.

1. Is this within the capability of a simple ASCII script?

2. Can I describe the various properties of a VideoFV when I apply it, or must I use a preset of that fx that already exists in the dialog?

My initial attempt will be with HSL Adjust....... Can someone please point me in the direction of a suitable example?

I have Visual Studio 2019 but I have not yet progressed to that level of complexity to be writing .dll

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 22.0 Build 239 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

jetdv wrote on 9/4/2025, 8:27 AM

@Richard-N - yes you can add an effect, yes you can choose a preset. If it's an OFX effect, you can even change the individual parameters.

etc... You might want to look at all my tutorials on that YouTube channel.

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

Thanks Edward,

My first expedition into C#....... I may have questions later!

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 22.0 Build 239 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/5/2025, 11:53 AM

@jetdv Edward, about those questions.......

I wrote this script in order to work towards adding an effect to a single video event selected on the timeline. I am finding the strict capitalisation of C# a major PITA after the simplicity of VB!

I reasoned that I should enumerate the tracks then enumerate the events on each track. Just to test the flow I added code to select every event present. This is the code, tested on a single video track containing a single still image:-

using ScriptPortal.Vegas;

public class EntryPoint
{
    Vegas myVegas;

    public void FromVegas(Vegas vegas)

    {
    myVegas = vegas;

    foreach (Track myTrack in myVegas.Project.Tracks)

        {
        foreach(TrackEvent myEvent in myTrack)

            {
                myEvent.Selected = true;

            }

        }
    }  
}

Unfortunately the host will not enumerate the track events. The script halts on the line with:

foreach(TrackEvent myEvent in myTrack) with the message:

C:\Users\Richard\Documents\VEGAS Script Menu\Test(15) : foreach statement cannot operate on variables of type 'ScriptPortal.Vegas.Track' because 'ScriptPortal.Vegas.Track' does not contain a public definition for 'GetEnumerator'

Is enumerating events beyond the capability of a simple script? Will I have to move to a Visual Studio compiled .DLL or have I made a schoolboy error?

 

Last changed by Richard-N on 9/5/2025, 11:54 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 22.0 Build 239 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/5/2025, 2:42 PM

@Richard-N

foreach(TrackEvent myEvent in myTrack.Events)

You have to tell the foreach what you're wanting to look at. In this case the "Events" in myTrack.

Richard-N wrote on 9/6/2025, 3:38 AM

@jetdv  Thanks Edward.

For several very good reasons, attempting to write scripts in a simple text editor is frought with difficulty. Without the intellisense provided by Visual Studio where the syntax and structure is checked on the fly, and the properties of each object are offered up as you type them in, it is almost impossible to write or debug effectively. Authoring DLLs in VS seems to be the way ahead.

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 22.0 Build 239 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/6/2025, 4:09 AM

I use visual studio with intellisense for my c#. Go back and look at the first VEGAS tutorial and I show you how to set it up.