Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro Vegas Pro Text&Tittles Scripting

  • Vegas Pro Text&Tittles Scripting

    Posted by Laguan Smich on September 26, 2024 at 10:26 am

    how to enter text&titles by marker from csv format I get the error:

    C:\Program Files\VEGAS\VEGAS Pro 20.0\Script Menu\Tittle.cs(108) : ‘ScriptPortal.Vegas.PlugInNode’ does not contain a definition for ‘CreateEffect’ and no extension method ‘CreateEffect’ accepting a first argument of type ‘ScriptPortal.Vegas.PlugInNode’ could be found (are you missing a using directive or an assembly reference?) C:\Program Files\VEGAS\VEGAS Pro 20.0\Script Menu\ Tittle.cs(108) : A local variable named ‘generator’ cannot be declared in this scope because it would give a different meaning to ‘generator’, which is already used in a ‘child’ scope to denote something else From the following script: using System;

    using System.IO;

    using System.Windows.Forms;

    using ScriptPortal.Vegas;

    using System.Collections.Generic;

    namespace SampleScript1 { public class EntryPoint { public void FromVegas(Vegas vegas) { // Path to CSV file string csvFilePath = @”D:\Project\data.csv”;

    // Read CSV var csvData = ReadCSV(csvFilePath);

    if (csvData == null || csvData.Count == 0) { MessageBox.Show(“Failed to read CSV or CSV is empty.”);

    return;

    } // Get all markers var markers = vegas.Project.Markers;

    if (markers.Count == 0) { MessageBox.Show(“No markers found in the project.”);

    return;

    } // Insert media generator according to marker for (int i = 0; i < markers.Count && i < csvData.Count; i++) { Marker marker = markers[i];

    string Data = csvData[i].Data;

    string Desk = csvData[i].Description;

    // Insert Datas & Text into timeline InsertDataAtMarker(vegas, marker.Position, Data, Desk);

    } MessageBox.Show(“Data inserted successfully according to markers.”);

    } private List<CSVData> ReadCSV(string filePath) { var csvData = new List<CSVData>();

    try { using (var reader = new StreamReader(filePath)) { while (!reader.EndOfStream) { var line = reader.ReadLine();

    var values ​​= line.Split(‘|’); // Assuming ‘|’ is the separator if (values.Length >= 2) { csvData.Add(new CSVData { Data = values[0], Description = values[1] });

    } } } } catch (Exception ex) { MessageBox.Show(“Error reading CSV: ” + ex.Message);

    } return csvData;

    } private void InsertDataAtMarker(Vegas vegas, Timecode position, string Data, string Desk) { // Select the track where the media generator will be inserted int trackIndex = 0;

    Track targetTrack = vegas.Project.Tracks[trackIndex];

    // Make sure the track is not empty if (targetTrack == null) { MessageBox.Show(“Target track not found.”);

    return;

    } // Find the “Datas & Text” generator PlugInNode DatasAndTextGenerator = null;

    foreach (var generator in vegas.Generators) { if (generator.Name == “Tittles & Text”) { DatasAndTextGenerator = generator;

    break;

    } } if (DatasAndTextGenerator == null) { MessageBox.Show(“Datas & Text generator not found.”);

    returns;

    } // Add Datas & Text generator var generator = DatasAndTextGenerator.CreateEffect();

    generator.Effect.SetStringParam(“Text”, Data + “\n” + Desk);

    // Add generator to desired position (based on marker) var videoEvent = new VideoEvent(position, Timecode.FromSeconds(5)); // Event duration 5 seconds videoEvent.Effects.Add(generator.Effect);

    targetTrack.Events.Add(videoEvent);

    } } public class CSVData { public string Data { get; set; } public string Description { get; set; } } }

    Hector Vera
    replied 2 weeks, 2 days ago
    2 Members · 0 Replies
  • 0 Replies
  • Hector Vera

    September 27, 2024 at 1:16 pm

    From what it looks like to me, it seems like a missing critical file on your Vegas PRO folder. If you are unable to locate the file through the search, I would suggest you try uninstalling your Vegas PRO and reinstalling the whole application again to see if you are able to get those files back in the proper location so you can use the text features within the application. Hope it works for you and that I hear from you soon!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy