-
scripting… taking the plunge…
Posted by Terence Kearns on November 30, 2011 at 8:26 amI’ve only used CSharp for one project, and that was about 6 years ago. Now my career has changed to photographer/videographer.
None, the less, I’ve decided to take the plunge and get into some Vegas scripting. I was gonna use JScript (because I have more experience with JavaScript), but the doco reckons “At some point in the future, you can expect Vegas to stop supporting VSA scripts since the .NET Framework will eventually drop the VSA engines. Most of the sample code in this document is written in C#.”
Anyways, wish me luck and feel free to offer words of warning and advice…
Cheers.
Terence Kearns replied 14 years, 5 months ago 4 Members · 8 Replies -
8 Replies
-
Terence Kearns
November 30, 2011 at 9:56 amThanks…
Just read the FAQ and now installing the free Visual C# 2010 Express from Microsoft.
-
Matt Carlson
November 30, 2011 at 8:18 pmMy advice to neophyte programmers switching languages is to take a Zen approach to what you are doing. Don’t think of your programming as “now I have to learn C#.” Object oriented languages have their quirks but they are all the same in concept. The same with interpreted languages (php, old BASIC, SQL) You still wan’t to do the same things and if you have any programming experience it is just a matter of keeping syntax straight in your head (or better yet have an internet connection and google always handy.) The jump from Java to C# is not that big.
-
Terence Kearns
November 30, 2011 at 10:08 pmThanks. The last and only time I used C# was to write two windows services as part of an automated lecture streaming application suite for a university. I just stumbled around until it worked (with lots of try/catch statements). I never formerly learned the language. I took a task-oriented approach and spent a lot of time on MSDN.
And now I’m stumbling around just trying to get Hello World extension up and running. PHP was my bread and butter, and of course some Javascript, but I want to get straight into writing an extension to house all my miscellaneous scriptings.
-
Frederic Baumann
November 30, 2011 at 10:26 pmAs mentioned earlier in this thread, take the script development kit available on the SCS web site, get Visual Studio C# 2010 Express.
It will be pretty easy to get the extension script running.
If it may help, here “my” a mini tutorial:
1) run VS2010
2) create a new C# project
3) create a new C# class:using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Sony.Vegas;namespace VegasScriptTest {
public class EntryPoint {
public void FromVegas(Vegas vegas) {
MessageBox.Show(vegas.Version);
}
}
}[Sorry: indentation does not appear here, don’t know why)
4) in the project properties, debug tab, set the “start external program” field to the path to Vegas110.exe (or Vegas100.exe)
5) Run the project: it will run Vegas
6) In Vegas, go to Tools > Script > Execute Script…
7) Select your .cs file
8) You should see a dialog box showing the Vegas version.Then you “just” have to browse the API documentation to find which objects, fields and methods you need to use for what you want to do 🙂
As far as I remember, you may also debug your script, executing it step by step (not 100% sure – did not do that for a while)
Some of the cool things using VS2010 is that you benefit from classes/fields/methods automatic completion, and syntax highlighting.
Hope this helps,
Frederic—

FBmn Software 1st birthday: save up to 30 Euros on all plug-ins and bundles
Check GPU-powered FBmn Software plug-ins to fix White Balance and Exposure issues.Want to learn on Sony Vegas Event Pan/Crop tool? Watch my tutorial.
Or about Keyframes? Watch this one. French version here. -
Terence Kearns
November 30, 2011 at 10:48 pmThanks Frederic, I took your advice and followed your tutorial but I ran into a couple of issues.
I’m running windows 7 (x64) with Vegas Pro 11 (x64)
Visual C# 2010 Express with .NET framework version 4VC doesn’t automatically references system.windows.forms, but no problems, I manually went and added the reference. I also went and added the reference to Sony.Vegas.dll
The DEBUG tab in the project properties does not have a
“start external program”I had to assume some things
– that the project is to be a “class library???”
– that Sony.Vegas.dll is okay to be targeted with .NET version 4???My debug tab has a section called “Startup Options” with 3 fields
– Command Line Arguments (text area)
– Working Directory (file location field)
– Enable the Visual Studio hosting process (checkbox)
…that’s it. -
Frederic Baumann
December 4, 2011 at 3:20 pmOops, you are right, the debugging option I mentioned is not available in the Express edition. Too bad.
Sorry for that.
Frederic
—

FBmn Software 1st birthday: save up to 30 Euros on all plug-ins and bundles
Check GPU-powered FBmn Software plug-ins to fix White Balance and Exposure issues.Want to learn on Sony Vegas Event Pan/Crop tool? Watch my tutorial.
Or about Keyframes? Watch this one. French version here. -
Terence Kearns
December 5, 2011 at 2:11 amCool. As long as it’s not just me going mad then.
Thanks again for the tips.
Reply to this Discussion! Login or Sign Up