hello sir, how are you..
i create custom command scripts after watching your first 3 videos.
using System;
using System.Windows.Forms;
using ScriptPortal.Vegas;
using System.Drawing;
using System.Collections;
using System.Runtime.InteropServices;
namespace MiniTools
{
public class MiniToolsDock : DockableControl
{
private Vegas vegas;
private MiniTools.MiniToolsMainForm myForm = null;
public MiniToolsDock(Vegas vegas) : base("MiniToolsInternal")
{
this.vegas = vegas; // Initialize vegas here
this.DisplayName = "MiniTools";
this.Dock = DockStyle.Fill;
}
public override DockWindowStyle DefaultDockWindowStyle
{
get { return DockWindowStyle.Docked; }
}
public override Size DefaultFloatingSize
{
get { return new Size(640, 480); }
}
protected override void OnLoad(EventArgs args)
{
try
{
myForm = new MiniTools.MiniToolsMainForm(vegas);
myForm.Dock = DockStyle.Fill;
this.Controls.Add(myForm);
}
catch (Exception ex)
{
MessageBox.Show("Failed to initialize MiniToolsMainForm: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
protected override void OnClosed(EventArgs args)
{
if (myForm != null)
{
myForm.Dispose();
myForm = null;
}
base.OnClosed(args);
}
}
}
public class MiniToolsCCM : ICustomCommandModule
{
public Vegas vegas = null;
CustomCommand CCM = new CustomCommand(CommandCategory.View, "MiniTools");
public void InitializeModule(Vegas vegas)
{
this.vegas = vegas; // Ensure vegas is set
CCM.MenuItemName = "MiniToolsMenu";
}
public ICollection GetCustomCommands()
{
CCM.MenuPopup += this.HandlePICmdMenuPopup;
CCM.Invoked += this.HandlePICmdInvoked;
CustomCommand[] cmds = new CustomCommand[] { CCM };
return cmds;
}
private void HandlePICmdMenuPopup(object sender, EventArgs e)
{
CCM.Checked = vegas.FindDockView("MiniToolsInternal");
}
private void HandlePICmdInvoked(object sender, EventArgs e)
{
try
{
if (!vegas.ActivateDockView("MiniToolsInternal"))
{
MiniTools.MiniToolsDock CCMDock = new MiniTools.MiniToolsDock(vegas);
CCMDock.AutoLoadCommand = CCM;
CCMDock.PersistDockWindowState = true;
vegas.LoadDockView(CCMDock);
}
}
catch (COMException comEx)
{
MessageBox.Show($"COM Exception: {comEx.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show($"Exception: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
are we need EntryPoint & FromVegas code for custom command too??
this is my form code's starting
using Microsoft.Win32;
using ScriptPortal.Vegas;
using System;
using System.Drawing;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace MiniTools
{
public partial class MiniToolsMainForm : UserControl
{
private Vegas vegas;
private MediaBin snapshotsBin;
private secondsValueForm secondsForm;
private numbersValueForm numbersForm;
public MiniToolsMainForm(Vegas vegas)
{
InitializeComponent();
this.vegas = vegas;
snapshotsBin = new MediaBin(vegas.Project, "Snapshots");
}
i add this in the end or not error persists.
/*
public class EntryPoint
{
private MiniTools.MiniToolsMainForm form;
public void FromVegas(Vegas vegas)
{
form = new MiniTools.MiniToolsMainForm(vegas);
form.Show();
}
}
*/
