Hello @jetdv sir.. need help.
Where I am wrong?
this is my program.cs
using ScriptPortal.Vegas;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MiniTools_Strips
{
public class Program
{
// You may want to remove this field if it's not used within the Program class
public Vegas vegas;
// Standard entry point method
[STAThread]
public static void Main()
{
// Initialize Vegas object (replace this with your actual initialization logic)
Vegas vegas = new Vegas(/* parameters */);
// You can directly initialize the main form here and run the application
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(vegas)); // Pass Vegas object to Form1 constructor
}
}
}
and this is my MiniTools-Strips.cs
using ScriptPortal.Vegas;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MiniTools_Strips
{
public partial class Form1 : Form
{
public Vegas vegas; // Changed variable name to lowercase
public Form1(Vegas vegas)
{
InitializeComponent();
this.vegas = vegas; // Adjusted assignment to lowercase
InitializeVegas();
}
private void InitializeVegas()
{
try
{
// Attempt to connect to the currently running instance of Vegas Pro
}
catch (Exception ex)
{
MessageBox.Show("Failed to initialize Vegas Pro: " + ex.Message);
}
}
private void deleteAllMarkersToolStripMenuItem_Click(object sender, EventArgs e)
{
if (vegas != null) // Adjusted variable reference to lowercase
{
vegas.Project.Markers.Clear();
vegas.UpdateUI();
}
else
{
MessageBox.Show("Vegas Pro is not initialized.");
}
}
private void deleteAllRegionsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (vegas != null) // Adjusted variable reference to lowercase
{
vegas.Project.Regions.Clear();
vegas.UpdateUI();
}
else
{
MessageBox.Show("Vegas Pro is not initialized.");
}
}
}
}
public class Entrypoint
{
public void FromVegas(Vegas vegas)
{
MiniTools_Strips.Form1 test = new MiniTools_Strips.Form1(vegas); // Pass Vegas object to Form1 constructor
}
}
and this is my MiniTools-Strips.Designer.cs
namespace MiniTools_Strips
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.markersRegionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteAllMarkersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteAllRegionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.markersRegionsToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
//
// markersRegionsToolStripMenuItem
//
this.markersRegionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.deleteAllMarkersToolStripMenuItem,
this.deleteAllRegionsToolStripMenuItem});
this.markersRegionsToolStripMenuItem.Name = "markersRegionsToolStripMenuItem";
this.markersRegionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.markersRegionsToolStripMenuItem.Text = "Markers / Regions";
//
// deleteAllMarkersToolStripMenuItem
//
this.deleteAllMarkersToolStripMenuItem.Name = "deleteAllMarkersToolStripMenuItem";
this.deleteAllMarkersToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.deleteAllMarkersToolStripMenuItem.Text = "Delete All Markers";
this.deleteAllMarkersToolStripMenuItem.Click += new System.EventHandler(this.deleteAllMarkersToolStripMenuItem_Click);
//
// deleteAllRegionsToolStripMenuItem
//
this.deleteAllRegionsToolStripMenuItem.Name = "deleteAllRegionsToolStripMenuItem";
this.deleteAllRegionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.deleteAllRegionsToolStripMenuItem.Text = "Delete All Regions";
this.deleteAllRegionsToolStripMenuItem.Click += new System.EventHandler(this.deleteAllRegionsToolStripMenuItem_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Name = "Form1";
this.Text = "Form1";
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem markersRegionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteAllMarkersToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteAllRegionsToolStripMenuItem;
}
}
this is solution explorer
and this is error & error line
please help solving this
i am not coder but i learn a little bit from ur videos and mostly take help from ChatGPT
so if this script worked then i can add more function by my own.
thankyou.
