Application extension in 'Vegas pro 11'

NicoM wrote on 12/13/2013, 10:58 AM
Hello,

I found some code sample for application extension, but I don't know where to drop the assembly.

I tried :
- C:\Program Files\Sony\Vegas Pro 11.0
- C:\Program Files\Sony\Vegas Pro 11.0\Script Menu
- C:\Program Files (x86)\Sony\Shared Plug-Ins
- C:\ProgramData\Sony\Vegas Pro\11.0
- C:\Users\<username>\AppData\Local\Sony\Vegas Pro\11.0
- C:\Users\<username>\Documents\Vegas Application Extensions

Can you tell me where ?

Thanks

Comments

Gary James wrote on 12/13/2013, 12:16 PM
C:\Users\<username>\Documents\Vegas Application Extensions.

When installed there, your Extension will appear under the Vegas View / Extensions menu.
JohnnyRoy wrote on 12/13/2013, 3:55 PM
> "When installed there, your Extension will appear under the Vegas View / Extensions menu."

Actually, what menu it shows up under is controlled by the extensions itself. They can show up under Edit, View, or Tools | Extension menu depending on where the extensions tells Vegas to place it. Extensions with a User Interface MUST be placed under the View menu. It you don't have a UI you can go under Edit or Tools depending on where you think it makes more sense.

Gary's recommended location is one good place to put your own extensions.

~jr
Gary James wrote on 12/13/2013, 8:13 PM
"Actually, what menu it shows up under is controlled by the extensions itself"

Is this controlled by the CommandCategory Enum type specified by the CustomCommand object instantiated in the Extension Startup code? I've only used CustomCommand.View in the few Extensions I've written, and never tried any of the other Enum values such as Edit or Tools.

I've also noticed that all versions of Vegas recognize Extensions installed in the C:\Users\userid\Documents\Vegas Application Extensions subdirectory. This makes installation very simple for any Vegas version.
JohnnyRoy wrote on 12/15/2013, 7:40 PM
> "Is this controlled by the CommandCategory Enum type specified by the CustomCommand object instantiated in the Extension Startup code? I've only used CustomCommand.View in the few Extensions I've written, and never tried any of the other Enum values such as Edit or Tools."

Yes, that's how you control it. If you don't need a UI, then you can have your extensions show up under Edit or Tools.

> "I've also noticed that all versions of Vegas recognize Extensions installed in the C:\Users\userid\Documents\Vegas Application Extensions subdirectory. This makes installation very simple for any Vegas version. "

Yes, these are all the places that Vegas Pro looks for extensions:


C:\Documents and Settings\<username>\My Documents\Vegas Application Extensions\
C:\Documents and Settings\<username>\Local Settings\Application Data\Sony\Vegas Pro\12.0\Application Extensions\
C:\Documents and Settings\<username>\Application Data\Sony\Vegas Pro\12.0\Application Extensions\
C:\Documents and Settings\All Users\Application Data\Sony\Vegas Pro\12.0\Application Extensions\
C:\Documents and Settings\<username>\Local Settings\Application Data\Sony\Vegas Pro\Application Extensions\
C:\Documents and Settings\<username>\Application Data\Sony\Vegas Pro\Application Extensions\
C:\Documents and Settings\All Users\Application Data\Sony\Vegas Pro\Application Extensions\

In later version of Windows "Documents and Settings" was renamed "Users" (like Mac OS X does) and "My Documents" was renamed "Documents" so use the one that's appropriate for your version of Windows.

All of the locations without a Vegas version number will work for any version of Vegas. So if you have an extensions that only works in one version you should use a version specific folder If your extension works with any version, use a location without a version number.

~jr
NicoM wrote on 12/16/2013, 5:38 AM
Sorry it stills not working.

What I have done precisely, listed below:
1. Get 'Vegas Pro 10.0 Script Developers Kit' here
http://www.sonycreativesoftware.com/download/devkits
2. With Visual Studio 2012, make a class Library containing 'SampleWebBrowser.cs'
3. Add reference to 'Vegas Pro 11.0\Sony.Vegas.dll' in the 'csproj'
4. Compile (no warnings, no errors, cool)
5. Copy 'SampleWebBrowser.dll' in 'C:\Users\<username>\Documents\Vegas Application Extensions'
6. Launch Vegas

The extension is not visible.
From Vegas, 'Edition->Extensions->...' remains desperately empty.
Did I forgot something ?

Don't know if it is important, but I launch the 'French' version of the tool.

Thanks
NicoM wrote on 12/16/2013, 5:43 AM
From Vegas 'Edition->Extensions', 'View->Extensions', 'Tools->Extensions', they are all empty.
Gary James wrote on 12/16/2013, 6:43 AM
By 'Edition->Extensions', I assume you meant 'Edit->Extensions'.

If your DLL isn't showing up in any of the 3 Extensions menus, and you have it located in a valid subdirectory, that tells me that Vegas is not able to find an Extension entry point in your DLL; so it thinks your DLL is just a regular DLL, not a Vegas Extension. The entry point is the InitializeModule function.

Are you sure the SampleWebBrowser & SampleWebBrowserModule classes and the entry point function are declared public?
NicoM wrote on 12/16/2013, 7:28 AM
I get this sample from 'Sony Vegas web page' itself.
I suppose/hope everything is in it.

Because I don't know how to attach document to my post, I copy/paste file body below, so you'll can tell if something is missing.

Thanks
/**
* This application extension demonstrates how to create a custom view
* command with a dockable control that contains a web browser. It
* also demonstrates how to use track asynchronous tasks using a
* ProgressWorker object.
*
* Revision Date: Jul 09, 2007.
**/
using System;
using System.Drawing;
using System.Threading;
using System.Collections;
using System.Diagnostics;
using System.Windows.Forms;
using Sony.Vegas;

namespace SampleWebBrowserExtenstion
{

public class SampleWebBrowser : DockableControl
{
WebBrowser myBrowser;

public SampleWebBrowser() : base("SampleWebBrowser")
{
this.DisplayName = "Sample Web Browser";
}

public override DockWindowStyle DefaultDockWindowStyle
{
get { return DockWindowStyle.Docked; }
}

public override Size DefaultFloatingSize
{
get { return new Size(640, 480); }
}

protected override void OnLoad(EventArgs args)
{
myBrowser = new WebBrowser();
myBrowser.Dock = DockStyle.Fill;
this.Controls.Add(myBrowser);
myBrowser.Navigating += this.HandleNavigating;
myBrowser.ProgressChanged += HandleProgressChanged;
myBrowser.DocumentCompleted += HandleDocumentCompleted;
myBrowser.StatusTextChanged += HandleStatusTextChanged;
myBrowser.Url = new Uri("http://www.sonycreativesoftware.com/");
}

ProgressWorker myNavWorker;
ManualResetEvent myNavEvent = new ManualResetEvent(false);

void HandleNavigating(Object sender, WebBrowserNavigatingEventArgs args)
{
if (null == myNavWorker)
{
myNavWorker = new ProgressWorker();
myNavWorker.BlockUserInput = false;
myNavWorker.DoWork += this.HandleNavWorkerDoWork;
myNavWorker.Dequeued += this.HandleNavWorkerDequeued;
myNavEvent.Reset();
myVegas.QueueProgressWorker(myNavWorker);
}
}

void HandleProgressChanged(Object sender, WebBrowserProgressChangedEventArgs args)
{
if (null != myNavWorker)
{
myNavWorker.ProgressMin = 0.0;
myNavWorker.ProgressMax = (double) args.MaximumProgress;
myNavWorker.Progress = (double) args.CurrentProgress;
}
}

void HandleStatusTextChanged(Object sender, EventArgs args)
{
if (null != myNavWorker)
{
myNavWorker.ProgressText = myBrowser.StatusText;
}
}

void HandleDocumentCompleted(Object sender, WebBrowserDocumentCompletedEventArgs args)
{
if (null != myNavWorker)
{
myNavWorker.Progress = myNavWorker.ProgressMax;
myNavEvent.Set();
}
}

void HandleNavWorkerDoWork(ProgressWorker worker, ProgressEventArgs args)
{
while (!worker.Canceled)
{
if (myNavEvent.WaitOne(100, false))
{
break;
}
}
if (worker.Canceled)
{
myBrowser.Stop();
}
}

void HandleNavWorkerDequeued(Object sender, EventArgs args)
{
myNavWorker = null;
}
}

public class SampleWebBrowserModule : ICustomCommandModule
{
protected Vegas myVegas = null;

public void InitializeModule(Vegas vegas)
{
myVegas = vegas;
}

CustomCommand mySampleWebBrowserCommand = new CustomCommand(CommandCategory.View, "Sample Web Browser");

public ICollection GetCustomCommands()
{
mySampleWebBrowserCommand.MenuPopup += this.HandleSampleWebBrowserCmdMenuPopup;
mySampleWebBrowserCommand.Invoked += this.HandleSampleWebBrowserCmdInvoked;
return new CustomCommand[] { mySampleWebBrowserCommand };
}

void HandleSampleWebBrowserCmdMenuPopup(Object sender, EventArgs args)
{
CustomCommand cmd = (CustomCommand) sender;
cmd.Checked = myVegas.FindDockView("SampleWebBrowser");
}

void HandleSampleWebBrowserCmdInvoked(Object sender, EventArgs args)
{
if (!myVegas.ActivateDockView("SampleWebBrowser"))
{
SampleWebBrowser dockView = new SampleWebBrowser();
dockView.AutoLoadCommand = mySampleWebBrowserCommand;
myVegas.LoadDockView(dockView);
}
}

}

}
Gary James wrote on 12/16/2013, 10:42 AM
I use Visual Studio 2010 Ultimate, so whenever I create a new project it defaults to using .Net 4.0. I've never had any luck making an Extension unless I use .Net 2.0. Also, you need to make sure your projects default namespace is the same as what's in the source code. Here are a couple of things to look at. The first shows my project settings. The second shows a build event that automatically copies the Extension DLL to the Vegas Extension directory after each build.



NicoM wrote on 12/16/2013, 11:57 AM
Thank you Gary,

You fix my problem.
Don't know how you did to attach these screen shots (I didn't see anything in the FAQ for that), but they were extremely helpful for me.
Gary James wrote on 12/16/2013, 12:41 PM
You are very welcome.

As for the screen shots, take a look at the top of the list of topics in this forum. Sticky #3 describes how to add markup to your posts so you can modify text, and add links and graphics to your posts. And if you feel like experimenting you can also try this. Open this text file, then create a new Browser bookmark. Edit the bookmark and past the contents of the text file into the bookmark replacing any URL that may already be present. When you've done that, if you create a new Post in the Vegas forums, or reply to an existing one, with the post editor window showing click on the new bookmark. The editor window will be refreshed and replaced with a editor that contain buttons that can add markup to your post for you.

In order to use markup with screen-shots, you must place your images on a website that has public access to them. Many people on this list use a free service called Dropbox.

Qbrick wrote on 9/18/2023, 2:14 AM
I get this sample from 'Sony Vegas web page' itself.
I suppose/hope everything is in it.

Because I don't know how to attach document to my post, I copy/paste file body below, so you'll can tell if something is missing.

Thanks
/**
* This application extension demonstrates how to create a custom view
* command with a dockable control that contains a web browser. It
* also demonstrates how to use track asynchronous tasks using a
* ProgressWorker object.
*
* Revision Date: Jul 09, 2007.
**/
using System;
using System.Drawing;
using System.Threading;
using System.Collections;

***

}

}

Thanks a lot!

I'm studing your script to understand ProgressWorker.

Anyway, how can I resolve this problem? (Visual Studio 2022 CE)

Cheers,

jetdv wrote on 9/18/2023, 7:26 AM

@Qbrick, have you looked at my Custom Command series - it also includes a base Custom Command you can use to begin your own extension.

Pre:

Part 1:

Entire Playlist:

https://www.youtube.com/playlist?list=PL_dUxRdFcIr_m-IPIxq4MAeAQtzgdGdX6