I can't find any examples of how to do anything in the Vegas Pro scripting API. The scripting FAQ is also extremely short and thus relatively useless. Where can I go to see some examples of conventional scripts for Vegas? https://nox.tips/
@jetdv creates some nice and simple tutorials for the scripting engine... which is really powerfull... you can create scriptable workflows (like in the tools menu) or compiled tools with integrated windows and buttons (like Vegsaur).
If you add the scripting engine libraries ("ScriptPortal.Vegas.dll" or ScriptpPortal.XXXX.dll) to your project as reference you can see all methods in the object browser or in intellisense.
Maybe @jetdv makes a tutorial "How to create an integrated window in VEGAS"
How do I create a window that can be docked in VEGAS' user interface?
The DockableControl class is special type of UserControl that can be docked in VEGAS' user interface. Typically, you will associate a DockableControl with a CustomCommand that appears in VEGAS' View.Extensions menu. When this command is invoked, your module will create a DockableControl and pass it to the Vegas object's LoadDockView method.
using System; using System.Drawing; using System.Collections; using System.Windows.Forms; using ScriptPortal.Vegas;
public class SampleModule : ICustomCommandModule { protected Vegas myVegas = null;
public void InitializeModule(Vegas vegas) { myVegas = vegas; }
CustomCommand myViewCommand = new CustomCommand(CommandCategory.View, "mySampleViewCommand");
public ICollection GetCustomCommands() { myViewCommand.DisplayName = "Hello World View"; myViewCommand.Invoked += this.HandleInvoked; myViewCommand.MenuPopup += this.HandleMenuPopup; return new CustomCommand[] { myViewCommand }; }
The DockableControl is constructed with a unique name string which can be used to activate the window using the ActivateDockView method. If this method returns true, the control has been loaded and VEGAS will bring it to the front of other docked windows. If ActivateDockView returns false, you should construct a new DockableControl and pass it to LoadDockView.
The MenuPopup event of your CustomCommand occurs when VEGAS shows the Extensions menu that contains the command. This is your opportunity to check if your DockableControl is loaded. You can set the Checked property of your command to indicate whether VEGAS should draw a box around your command's icon in the Extensions menu.
If you add the scripting engine libraries ("ScriptPortal.Vegas.dll" or ScriptpPortal.XXXX.dll) to your project as reference you can see all methods in the object browser or in intellisense.
The first Vegas only video created (second on the site) talks about what is needed, recommends using Visual Studio, and shows adding the ScriptPortal.Vegas.dll to the project and using intellisense.
The second Vegas only video (third on the site) extends that to show how to debug the script in Vegas with breakpoints and stepping through lines and looking at variables.
Maybe @jetdv makes a tutorial "How to create an integrated window in VEGAS"
The one I'm going to upload Monday 2/22/21 shows how to create a standard script that contains a form using Visual Studio, get's an input number from the form, uses a button to start it's task, and still allows full debugging in Vegas.
I do plan on showing how to make a Custom Command/Extension, but that's farther down the road. Right now I'm at 3 weeks into the tutorials and 3 weeks is a little early to jump into Custom Commands without expanding on the other stuff a little more first.
Here's an old post you might want to look at. It's from 2007 and it references "Sony" instead of "ScriptPortal" so you'll need to make that change. Otherwise, it pretty well lays out what is needed to create a custom command and get it to where you can debug in Vegas as well.
Any time you see "TransportTools" or "TransportStreamTools" or "Transport Stream Tools", change it to reference what you want to call this. Then, you need to figure out what category you want it under. There are three categories: edit, view, and tools. If it has a GUI, it would typically be under "view" which will place it in View - Extensions in Vegas. So you would change to CommandCategory.View instead of CommandCategory.Tools.
Hello, i tried the SampleModule class above, but it doesn't seem to work in Vegas Pro 17..
When i run it through Tools > Scripting, it throws this error..
System.ApplicationException: Failed to create instance of main class: 'EntryPoint'.
at ScriptPortal.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)
I tried playing around with it, and changing it to this..
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ScriptPortal.Vegas;
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
DockableControl dockView = new DockableControl("HellowWorldView");
Label label = new Label();
label.Dock = DockStyle.Fill;
label.Text = "hello world";
label.TextAlign = ContentAlignment.MiddleCenter;
dockView.Controls.Add(label);
vegas.LoadDockView(dockView);
}
}
The DockableControl dockView line throws this error now..
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ApplicationException: Error in the application.
at ScriptPortal.Vegas.DockableControl..ctor(String instanceName)
at EntryPoint.FromVegas(Vegas vegas)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at ScriptPortal.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)