Automatic script

Sr_Garcia wrote on 8/1/2024, 2:28 AM

For more efficient editing, I've created several scripts to have a "shortcut" to the effects.
(example:This example is the one that doesn't work)

 

--------------------------------------------------------------------------------------------------------------------

import ScriptPortal.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;

var plugInName = " Enfoque de VEGAS por IA ";
var presetName = "Default";

try
{
for (var track in Vegas.Project.Tracks) {
for (var evnt in track.Events) {
if (!evnt.Selected || evnt.MediaType != MediaType.Video) continue;

var fx = Vegas.VideoFX;

var plugIn = fx.GetChildByName(plugInName);
if (null == plugIn) {
throw "could not find a plug-in named: '" + plugInName + "'";
}

var effect = new Effect(plugIn);
evnt.Effects.Add(effect);
if (null != presetName) {
effect.Preset = presetName;
}
}
}
}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

-------------------------------------------------------------------------------------------------------------------------------------------

 


I've tried to create one for the new AI Sharpening option but there is some problem (error) and I can't solve it.
Does anyone know how to do it?

Thanks!

Comments

zzzzzz9125 wrote on 8/1/2024, 3:08 AM

@Sr_Garcia Use its Unique ID to find it:

var plugInUID = "{Svfx:de.magix:AiSharpen}";

...

var plugIn = fx.GetChildByUniqueID(plugInUID);

 

Using VEGAS Pro 22 build 248 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

Sr_Garcia wrote on 8/1/2024, 4:58 AM

Thank you for your reply.
My problem is that I am completely unfamiliar with the script creation process.

I create an icon (16x16) that I place on the toolbar. From this icon I run the script directly. The thing is that after replacing the lines of the original script (which does not work) with what you have indicated, it still gives an error.

Would you be so kind as to completely modify the original script with the appropriate instructions so that it works?

Thank you very much!!

zzzzzz9125 wrote on 8/1/2024, 5:32 AM

The thing is that after replacing the lines of the original script (which does not work) with what you have indicated, it still gives an error.

@Sr_Garcia First of all: When you say there's a problem in your code, please include the error message.

You didn't include it, so let me guess, you didn't change this line:

throw "could not find a plug-in named: '" + plugInName + "'";

In your code, plugInName should have been replaced by plugInUID. In that case, it shouldn't be present here. Change it to anything else, it's just a non-issue.

Using VEGAS Pro 22 build 248 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

Sr_Garcia wrote on 8/1/2024, 6:19 AM

ALL OK!!
Thanks for your help
My ignorance regarding scripts is total... without your instructions I would never have achieved it.

Thank you very much!!!

bitman wrote on 8/1/2024, 8:24 AM

@Sr_Garcia

below is a working version, a bit different, but it works

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Globalization; 
using System.Collections.Generic;
using System.Collections;
using System.IO;
using ScriptPortal.Vegas;
using System.Text;
 
public class EntryPoint
{
    Vegas myVegas;
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;
        foreach (Track myTrack in myVegas.Project.Tracks)
        {
            if (myTrack.IsVideo())
            {    
                foreach(TrackEvent evnt in myTrack.Events)
                {
                    if (evnt.Selected)
                    {
                        VideoEvent vEvent = (VideoEvent)evnt;
                        string plugInUID = "{Svfx:de.magix:AiSharpen}";
                        PlugInNode fx = myVegas.VideoFX;  
                        PlugInNode plugIn = fx.GetChildByUniqueID(plugInUID);
                        Effect effect = new Effect(plugIn);
                        vEvent.Effects.Add(effect);        
                    }
                }    
            }
        }
    }
}

 

APPS: VIDEO: VP 365 suite (VP 22 build 194) VP 21 build 315, VP 365 20, VP 19 post (latest build -651), (uninstalled VP 12,13,14,15,16 Suite,17, VP18 post), Vegasaur, a lot of NEWBLUE plugins, Mercalli 6.0, Respeedr, Vasco Da Gamma 17 HDpro XXL, Boris Continuum 2025, Davinci Resolve Studio 18, SOUND: RX 10 advanced Audio Editor, Sound Forge Pro 18, Spectral Layers Pro 10, Audacity, FOTO: Zoner studio X, DXO photolab (8), Luminar, Topaz...

  • OS: Windows 11 Pro 64, version 24H2 (since October 2024)
  • CPU: i9-13900K (upgraded my former CPU i9-12900K),
  • Air Cooler: Noctua NH-D15 G2 HBC (September 2024 upgrade from Noctua NH-D15s)
  • RAM: DDR5 Corsair 64GB (5600-40 Vengeance)
  • Graphics card: ASUS GeForce RTX 3090 TUF OC GAMING (24GB) 
  • Monitor: LG 38 inch ultra-wide (21x9) - Resolution: 3840x1600
  • C-drive: Corsair MP600 PRO XT NVMe SSD 4TB (PCIe Gen. 4)
  • Video drives: Samsung NVMe SSD 2TB (980 pro and 970 EVO plus) each 2TB
  • Mass Data storage & Backup: WD gold 6TB + WD Yellow 4TB
  • MOBO: Gigabyte Z690 AORUS MASTER
  • PSU: Corsair HX1500i, Case: Fractal Design Define 7 (PCGH edition)
  • Misc.: Logitech G915, Evoluent Vertical Mouse, shuttlePROv2

 

 

jetdv wrote on 8/1/2024, 9:18 AM

@Sr_Garcia, you might want to go through my tutorials...

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

Sr_Garcia wrote on 8/1/2024, 10:14 AM

Thanks bitman and jetdv!!
I'll keep that in mind, but it's VERY COMPLICATED for me to understand the procedure since I have no training on scripts.

I'm sure that if I want to do any "experiment" with scripts, I'll have to ask for help again. 😏

Thanks to both of you. !!